tags:

views:

49

answers:

2

I am creating a Java applet, and I am trying to add a JFrame to it. I am calling:

add(new MyJFrameSubclass());

But when I launch the application, my JFrame isn't shown until I resize the window.

+1  A: 

JFrame and JApplet are both top-level containers. Instead of trying to have both containers present at once, put your content in a lightweight container such as JPanel; then add that JPanel to either a JFrame (for local use) or a JApplet (for the browser). This example shows the approach.

trashgod
I did try a JPanel as well but I'll take a look at your example, thanks.
Jamie Allfrey
+1  A: 

This may be too elementary of a suggestion, but sticking in a validate() or repaint() can sometimes solve problems that seem complicated.

Kate