So I have a bunch of JTable s. Each JTable is inside a JScrollPane . Then I add each of these JScrollPane to the JPanel . Then I add this JPanel to JScrollPane , and then to another JPanel with BorderLayout . The larger JScrollPane correctly with the parent, but each of the smaller JScrollPane has a constant height, which is larger than the window when it is small. How can I get each of the JScrollPane children to resize with the window / parent height?
I tried adding more intermediate JPanel with FlowLayout , BorderLayout , and nothing works.
Here is the code:
public class MyPanel extends JPanel { public MyPanel() { super(new BorderLayout()); JPanel panel = new JPanel(); for (int i = 0; i < 5; i++) {
I'm just trying to get a bunch of tables with scrollbars horizontally next to each other inside a larger panel with a horizontal scrollbar. And I want all these things to change accordingly when the window is resized.
more code:
final MyPanel panel = new MyPanel(); final JTabbedPane tabView = new JTabbedPane(); tabView.add(...); tabView.add("foo", panel); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, ..., tabView); this.add(splitPane);
source share