Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamically grow JPanel

843805Mar 6 2007 — edited Mar 6 2007
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 3 2007
Added on Mar 6 2007
1 comment
98 views