Reputation: 6042
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
scrollPane , scrollPane2);
I want to do very trivial action and I it doesn't work.
Whenever I add label to either of scrollPanes - they simply don't display anything. I can display tables within panes but these are added through the constructor. Pisses a lot.
Also if splitPane only allows two components - what if I want to separate window into four parts? SplitPane of SplitPane?
Thanks for help,
Upvotes: 2
Views: 315
Reputation: 205795
You might compare your implementation to this example that adds a JLabel
instance to a JPanel
on each side of the JSplitPane
.
Although JSplitPane
only admits two components, you can add another JSplitPane
to either pane in order to subdivide either side in either direction, ad libitum.
Upvotes: 5
Reputation: 4744
Don't forget to call updateUI()
after you've added your components. JSplitPane
is really only supposed to be used for splitting into two components. If you require more, consider using a TableView
.
Upvotes: 0