GUI Stuff

Simple intro to GUI Builders – use the Examples on the new Processing 2.x to see more


import guicomponents.*;

GButton btnSmile0, btnSmile1,btnControl;

GLabel label;

void setup()
{

    size(480, 540);

  G4P.setColorScheme(this, GCScheme.BLUE_SCHEME);
  G4P.setFont(this, "Verdana", 12);

  G4P.setMouseOverEnabled(true);
  
  btnSmile0 = new GButton(this,"Tytheringon Rocks",50,150,400,70);
  btnSmile0.tag = "Button1";
  
  btnSmile1 = new GButton(this,"Beech Hall Rocks",50,270,400,70);
  btnSmile1.setFont("Verdana", 20, false);
  btnSmile1.tag = "Button2";
  
  //btnControl = new GButton(this, "Open Panel Position Window", 10, 0 - 100,200,30);
}

void handleButtonEvents(GButton button) {
  
  System.out.print(button.tag+"\t\t");
  
  switch(button.eventType){
  case GButton.PRESSED:
    System.out.println("PRESSED");
    break;
  case GButton.RELEASED:
    System.out.println("RELEASED");
    break;
  case GButton.CLICKED:
    System.out.println("CLICKED");
    break;
  default:
    System.out.println("Unknown mouse event");
  }
}  

void draw(){
  background(200);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s