I don't really have example code for this (so I'll try to explain it), but I'm wondering if there is a way to stop JSplitPane
from mashing my layouts?
I have two panels that I add into a JSplitpane
which both have GridBagLayout
on them. On the left pane I have a table. On the right pane I have a JPanel
that displays information when the user interacts with the table. However, when the information is displayed on the right pane, the table gets mashed. (unable to display unless the divider is dragged all the way to the right).
I would think with a GridBagLayout
that my table should still be visible no matter what. Even if it squished the columns and rows in.
I'm just wondering if this is a common problem, if so, is there a fix?
My issue was that when the table was clicked I reset the constraints to the JSplitPane. This caused the constraints to disappear and leave the GUI to do what is pleased.
Pseudo:
//set constraints for panel that contains table and random components
//if table clicked add data (with GridBagLayout) in other side of splitpane <-- this is where I accidentally reset the layout
So as soon as that line of code was removed, it functioned as expected.