The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

PApplet question

Hello, in this example I have two applets which I'm running as a Java Application. This might sound silly but how can I close one of the windows so that the other one remains open? because every time I close it my program just ends.

Normally, if I were using an ordinary frame I would write "myFrame.setVisible(false);" but I don't know how to do that with applets. On the PApplet webpage it says that 'set'Visible()' is inherited from java.awt.Component. Problem is, I just don't know how to call the setVisible method from an applet.

Re: PApplet question

No idea what the PApplet class does. You will have to read its API doc to see how to use it.
In java, an applet extends the Applet class which looks like it is not related to the PApplet class.
An applet runs in a browser, not as an application.

Re: PApplet question

Originally Posted by Norm

No idea what the PApplet class does. You will have to read its API doc to see how to use it.
In java, an applet extends the Applet class which looks like it is not related to the PApplet class.
An applet runs in a browser, not as an application.

Thanks, I've asked around in several forums and it seems nobody knows the PApplet class.

Re: PApplet question

PApplet is used by Processing, and it extends java.awt.Frame. If you're running this from Java (as opposed to from Processing itself), you should just be able to call setVisible(). That method is indeed inherited from Component, but it's overriden by Frame. Frame extends Window, which extends Container, which extends Component.

Re: PApplet question

Originally Posted by knightmetal

Normally, if I were using an ordinary frame I would write "myFrame.setVisible(false);" but I don't know how to do that with applets. On the PApplet webpage it says that 'set'Visible()' is inherited from java.awt.Component. Problem is, I just don't know how to call the setVisible method from an applet.