I have a simple MultiSplitPane in java. It has 1 Row (split) and 2 nodes (Leaves) in it. How can I add another row under the existing one.
Here's the code that creates the MultiSplitPane and the 2 Leaves:
List children =
Arrays.asList(new Leaf("left"),
new Divider(),
new Leaf("right"));
Split modelRoot = new Split();
modelRoot.setChildren(children);
MultiSplitPane multiSplitPane = new MultiSplitPane();
multiSplitPane.getMultiSplitLayout().setModel(modelRoot);
multiSplitPane.add(new JButton("Left Component"), "left");
multiSplitPane.add(new JButton("Right Component"), "right");
This is how I can add another Leaf, but I need to add new Split (row):
Leaf newLeaf = new Leaf("newLeaf");
Split newSplit = (Split) multiSplitPane.getMultiSplitLayout().getModel();
java.util.List newList = new ArrayList();
newList.add(newLeaf);
newList.add(new Divider());
newList.addAll(newSplit.getChildren());
newSplit.setChildren(newList);
multiSplitPane.setModel(newSplit);
multiSplitPane.add(new JButton("new"), "newLeaf");
revalidate();