Skip to content

Commit bc577fd

Browse files
hansonrhansonr
authored andcommitted
JSSplitPane dividerColor; did not work
1 parent 9822123 commit bc577fd

File tree

1 file changed

+35
-25
lines changed

1 file changed

+35
-25
lines changed

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSSplitPaneUI.java

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ public DOMNode updateDOMNode() {
177177

178178
private boolean isHorizontal;
179179

180+
private Color dividerColor;
181+
180182
// /**
181183
// * Creates a new BasicSplitPaneUI instance
182184
// */
@@ -212,31 +214,36 @@ public void installUI(JComponent jc) {
212214
}
213215

214216
protected void fHandleDrag(Object xyev, int type) {
215-
getCursor();
216-
if (splitPane.isEnabled())
217-
switch (type) {
218-
case MouseEvent.MOUSE_MOVED:
219-
divider.setCursor(cursor);
220-
return;
221-
case MouseEvent.MOUSE_PRESSED:
222-
this.xyev = xyev;
223-
this.pressedLocation = splitPane.getDividerLocation();
224-
divider.setCursor(cursor);
225-
JSInterface.setCursor(JSToolkit.getCursorName(cursor));
226-
return;
227-
case MouseEvent.MOUSE_DRAGGED:
228-
int d = this.pressedLocation + /** @j2sNative (this.isHorizontal ? xyev.dx : xyev.dy) || */
229-
0;
230-
int max = getMaximumDividerLocation(splitPane);
231-
int min = getMinimumDividerLocation(splitPane);
232-
d = Math.max(min, Math.min(max, d));
233-
splitPane.setDividerLocation(d);
234-
return;
235-
case MouseEvent.MOUSE_RELEASED:
236-
break;
237-
}
238-
JSInterface.setCursor(null);
239-
divider.setCursor(null);
217+
if (!splitPane.isEnabled()) {
218+
JSInterface.setCursor(null);
219+
divider.setCursor(null);
220+
return;
221+
}
222+
divider.setCursor(getCursor());
223+
switch (type) {
224+
case MouseEvent.MOUSE_MOVED:
225+
// divider.setBackground(dividerColor);
226+
return;
227+
case MouseEvent.MOUSE_PRESSED:
228+
this.xyev = xyev;
229+
this.pressedLocation = splitPane.getDividerLocation();
230+
JSInterface.setCursor(JSToolkit.getCursorName(cursor));
231+
// divider.setBackground(Color.DARK_GRAY);
232+
return;
233+
case MouseEvent.MOUSE_DRAGGED:
234+
int d = this.pressedLocation + /** @j2sNative (this.isHorizontal ? xyev.dx : xyev.dy) || */
235+
0;
236+
int max = getMaximumDividerLocation(splitPane);
237+
int min = getMinimumDividerLocation(splitPane);
238+
d = Math.max(min, Math.min(max, d));
239+
splitPane.setDividerLocation(d);
240+
return;
241+
case MouseEvent.MOUSE_RELEASED:
242+
JSInterface.setCursor(null);
243+
// unfortunately, this can be lost
244+
// divider.setBackground(dividerColor);
245+
return;
246+
}
240247
}
241248

242249
private Cursor getCursor() {
@@ -249,7 +256,9 @@ private Cursor getCursor() {
249256

250257
private void setupDivider() {
251258
divider = new SplitPaneDivider(this);
259+
dividerColor = divider.getBackground();
252260
enableDragging();
261+
divider.setCursor(getCursor());
253262
}
254263

255264
private void enableDragging() {
@@ -2191,6 +2200,7 @@ public void focusLost(FocusEvent ev) {
21912200
public void setEnabled(boolean b) {
21922201
super.setEnabled(b);
21932202
splitPane.setCursor(b ? getCursor() : null);
2203+
divider.setCursor(b ? getCursor() : null);
21942204
}
21952205

21962206
@Override

0 commit comments

Comments
 (0)