Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have to resize my JFrame for the contents to show up. How can i fix that?

When I run my gui, I have to resize the window for everything to show up. Does someone know what the problem is?

like image 245
Jeel Shah Avatar asked Mar 31 '11 11:03

Jeel Shah


3 Answers

Call pack() on your JFrame, after adding all your components and before calling setVisible(true).

like image 56
Klarth Avatar answered Sep 29 '22 08:09

Klarth


When you create the frame call the setSize() method on the frame to set the initial starting size.

like image 30
jzd Avatar answered Sep 29 '22 07:09

jzd


setVisible(true);

after you have added all desired JComponents to your JFrame helped for me.

like image 20
Commander_Keen Avatar answered Sep 29 '22 09:09

Commander_Keen