• Advertisement
Sign in to follow this  

[java] Swing component visibility problem within Applets

This topic is 4913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got a simple animation JApplet up and running which has some Swing controls (JButtons) added to adjust various animation settings. The problem is these components don't become visible until I click the area on the applet where the control has been added to, I'd lke them to be visible from when the applet loads. I know I'm not drawing over the control because when it becomes visible it remains visible. I've looked through the Java API docs and couldn't find anything so any help on this matter would be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You added the controls on a separate JPanel, and you put the JPanel in the JApplet, right? And then you draw the animation on the JApplet, right?

Then your controls are still in the same Container as your animation, and therefore you draw over your controls. You really should make a class extends JPanel, override its paint and update methods, and use it to display your animation. Then you can put the controls and the animation JPanel in the JApplet.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement