how do I set SetUndecorated to true after after Processing launches?

edited July 2015 in How To...

I want to be able to remove the window frame and re-enable the window frame. When I try to remove the frame do it I lose all Mouse and key control for the sketch. So I am definitely unable to add the frame back in.

void setup(){
size(830, 650 );

}



void draw(){
background(0,0,255);

}

void mousePressed(){
exit();

}

int window = 1;

void keyPressed() {


  if (key=='f') {
    if (window==1) {

      // to make a frame not displayable, you can
      // use frame.removeNotify()
     frame.removeNotify();
      frame.setUndecorated(true);

      // addNotify, here i am not sure if you have 
      // to add notify again.  
      frame.addNotify();
      super.init();
      frame.setLocation(0, 0);
      size(830, 650);

      window=2;

    } else if(window ==2) {

      // to make a frame not displayable, you can
      // use frame.removeNotify()
      frame.removeNotify();
      frame.setUndecorated(false);
      // addNotify, here i am not sure if you have 
      // to add notify again.  
      frame.addNotify();
      super.init();
      size(500,500);
      window=1;
    }
  }
}
Sign In or Register to comment.