tags:

views:

41

answers:

2

I am writing a program that has multiple text area separated by tabs. It works fine, except that when I first compile it none of the components appear on the window; it is solid grey. When I resize the window, though, they appear and the program runs fine.

Any suggestions as to why this occurs and how to fix it?

A: 

Did you try a call to pack() on your top level component before calling setVisible(true)?

Savvas Dalkitsis
A: 

Components need to be added to the frame before the frame is made visible.

If you add components after the frame is visible then you need to use:

panel.add( someComponent );
panel.revalidate();
panel.repaint();
camickr