Dynamically grow JPanel
843805Mar 6 2007 — edited Mar 6 2007Hi I have a JFrame with 3 JPanels using BorderLayout. The bottom panel has a JTabbedPane, when i select one of the tabs i want the bottom panel to grow visibly. I have a for loop that uses setPreferedSize(x,y) increasing the y value by 1 each iteration with a sleep in between.
for (int i = 0; i < 100; i++) {
Thread.sleep(20);
this.setPreferredSize(new Dimension(800, i));
this.invalidate();
this.validate();
this.repaint();
this.setVisible(true);
}
It basically goes from the initial size to the maximum size once the loop has finished. If i do this with a JFrame it will display the frame "growing".
Is this possible
Finally i am using JDK1.3 for this application.
Thanks