PApplet question

Discussion in 'Programmer's Corner' started by krow, Mar 24, 2012.

  1. krow

    Thread Starter Member

    May 25, 2010
    49
    0
    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.

    Thanks for your help.

    Code ( (Unknown Language)):
    1.  
    2.  
    3. import processing.core.PApplet;
    4.  
    5. public class Class1 extends PApplet {
    6.  
    7.     public void setup() {
    8.         size(200, 200);
    9.         background(0);
    10.     }
    11.  
    12.     public void draw() {
    13.  
    14.     }
    15.  
    16.     public static void main(final String[] args) {
    17.         PApplet.main(new String[]{"Class1"});
    18.         PApplet.main(new String[]{"Class2"});
    19.     }
    20. }
    21.  
    Code ( (Unknown Language)):
    1.  
    2.  
    3. import processing.core.PApplet;
    4.  
    5. public class Class2 extends PApplet{
    6.    
    7.     public void setup() {
    8.         size(400, 400);
    9.         background(0);
    10.     }
    11.  
    12.     public void draw() {
    13.  
    14.     }
    15.    
    16. }
    17.  
     
Loading...