Reputation: 457
As a part for my first GUI App I want to show 2 Tables the following way:
https://i.sstatic.net/6mq0m.jpg
I´m unable to print the 2 tables that way! Here is my code so far:
// Center
JPanel panel_center = new JPanel();
panel_overview.add(panel_center, BorderLayout.CENTER);
panel_center.setLayout(new BorderLayout());
JPanel panel_center_table = new JPanel();
panel_center.add(panel_center_table, BorderLayout.NORTH);
panel_center_table.setLayout(new GridLayout(2, 1));
JPanel panel_table_north = new JPanel();
panel_center_table.add(panel_table_north);
JPanel panel_table_south = new JPanel();
panel_center_table.add(panel_table_south);
JPanel panel_center_combobox = new JPanel();
panel_center.add(panel_center_combobox, BorderLayout.NORTH);
panel_center_combobox.setLayout(new BorderLayout());
panel_center_combobox.add(combobox_table_chooser, BorderLayout.WEST);
Upvotes: 0
Views: 190
Reputation: 5386
You could also try using a split pane. That way, the user can control the height of each of the tables.
Upvotes: 1
Reputation: 44240
Consider using a different layout manager. I'd recommend using a BoxLayout
, since you'll be able to easily stack components on top of each other. Here's a How To Use BoxLayout tutorial.
Upvotes: 2