I have a JFrame with about 10 components (JLabel, Combobox, Buttons, TextFields). When I start the program, sometimes it doesn't display all of them. I tried repaint in different place and problem still there Any one help me
A:
The general order of code for creating a GUI is:
panel.add( component1 );
panel.add( component2 );
frame.add( panel );
frame.pack();
frame.setVisible( true );
That is all components should be added to the frame before the frame is made visible.
camickr
2010-09-08 14:51:21
Yeah, It works. I think all of you are right. I added "pack()" and the problem has gone. :) Thanks
Steve
2010-09-08 15:01:16