-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathSingleLineSplitPane.java
More file actions
45 lines (37 loc) · 1.37 KB
/
SingleLineSplitPane.java
File metadata and controls
45 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package nodebox.client;
import javax.swing.*;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import javax.swing.plaf.basic.BasicSplitPaneUI;
import java.awt.*;
public class SingleLineSplitPane extends CustomSplitPane {
public SingleLineSplitPane(int orientation, Component c1, Component c2) {
super(orientation, c1, c2);
setDividerSize(3);
}
@Override
protected BasicSplitPaneUI createUI() {
return new SingleLineSplitPaneUI();
}
private class SingleLineSplitPaneUI extends BasicSplitPaneUI {
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(SingleLineSplitPaneUI.this) {
@Override
public boolean isOpaque() {
return false;
}
@Override
public void paint(Graphics g) {
g.setColor(Theme.DEFAULT_SPLIT_COLOR);
Rectangle r = g.getClipBounds();
if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
int cx = r.x + r.width / 2;
g.drawLine(cx, r.y, cx, r.height);
} else {
int cy = r.y + r.height/ 2;
g.drawLine(r.x, cy, r.width, cy);
}
}
};
}
}
}