Sign in to follow this  
Spudder

[java] Swing component visibility problem within Applets

Recommended Posts

Spudder    385
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
Koroljov    115
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this