3 import javajs.awt.Container;
6 public class JSplitPane extends JComponent {
8 public static final int HORIZONTAL_SPLIT = 1;
10 private int split = 1;
11 private Container right;
12 private Container left;
14 public JSplitPane(int split) {
17 isH = (split == HORIZONTAL_SPLIT);
20 public void setRightComponent(JComponent r) {
21 right = new JComponentImp(null);
25 public void setLeftComponent(JComponent l) {
26 left = new JComponentImp(null);
31 public int getSubcomponentWidth() {
34 int wleft = left.getSubcomponentWidth();
35 int wright = right.getSubcomponentWidth();
36 if (wleft > 0 && wright > 0) {
40 w = Math.max(wleft, wright);
47 public int getSubcomponentHeight() {
50 int hleft = left.getSubcomponentHeight();
51 int hright = right.getSubcomponentHeight();
52 if (hleft > 0 && hright > 0) {
54 h = Math.max(hleft, hright);
63 public String toHTML() {
64 if (left == null || right == null)
66 boolean isH = (split == HORIZONTAL_SPLIT);
68 width = getSubcomponentWidth();
70 height = getSubcomponentHeight();
72 sb.append("<div id='" + id + "' class='JSplitPane' style='" + getCSSstyle(100, 100) + "'>");
74 sb.append("<div id='" + id + "_left' style='width:50%;height:100%;position:absolute;top:0%;left:0%'>");
76 sb.append("<div id='" + id + "_top' style='width:100%;height:50%;position:absolute;top:0%;left:0%'>");
77 sb.append(left.getComponents()[0].toHTML());
79 sb.append("</div><div id='" + id + "_right' style='width:50%;height:100%;position:absolute;top:0%;left:50%'>");
81 sb.append("</div><div id='" + id + "_bottom' style='width:100%;height:50%;position:absolute;top:50%;left:0%'>");
82 sb.append(right.getComponents()[0].toHTML());
83 sb.append("</div></div>\n");