I have a JTable for each item in a JComboBox. The JTable related to the selected JComboBox item is put into a JPanel. Before adding it to the JPanel, I made sure to remove the previous table. My problem is that when I choose a different item in the JComboBox, the new JTable won't show until I resize the window or do something to force it to refresh. How can I get it to refresh automatically?
JPanel.invalidate() didn't seem to work, but JPanel.validate() did. Thanks. However, I'm having one more issue out of this. JPanel contains two JTables. When I call JPanel.validate(), it seems to "reload" or "repaint" the first table, but not the second. Any clue on how to do this?
2 panels, one for each JTable. panel 3 holds panel1 and panel2 (both JTables) frame.setContent(panel3); .validate() panel3 would refresh both? correct me if i'm wrong on this one. not testing this in code.
Joined: Feb 11, 2004
Are JPanels the only way to "customize" Layouts? BorderLayout, GridLayout and FlowLayout all seem so restrictive that I am at the point of having panel over panel over panel - so on and so forth - to make my GUI arrange things in a more designed and not so boxed way?