Notice: This is a static archive of the Mobile Processing website, as the project is no longer significantly active. All forms and the Discourse boards are no longer functional, and the mobile website at http://wapmp.at/ is no longer available. Please visit the Mobile Processing Google Group for any remaining discussions and the Processing website for the latest news about Processing.
Index
Name

PCheckBox

Examples
PCheckBox option;
PFont font;
String msg;

void setup() {
  option = new PCheckBox(false);
  option.setBounds((width - 20) / 2, 
                   (height - 20) / 2, 
                   20, 20);
  
  font = loadFont();
  msg = "";
  textFont(font);
  textAlign(CENTER);
}

void draw() {
  background(200);
  option.draw();
  fill(0);
  text(msg, width / 2, 
       option.y + option.height + 4 + font.baseline);
}

void keyPressed() {
  option.keyPressed();
}

void keyReleased() {
  option.keyReleased();
}

void libraryEvent(Object library, int event, Object data) {
  if (library == option) {
    if (option.checked) {
      msg = "Checked!";
    } else {
      msg = "Not checked anymore";
    }
  }
}

Description A check box component. Does not include a text label, use PLabel to draw a label next to it. The bounds of the component represent the size of the checkbox.
Fields
checked   True if the check box has been "checked"

Methods
keyPressed()   Handles pressing and selecting/de-selecting this checkbox when the FIRE button is pressed.

keyReleased()   Releases the pressed state of this checkbox when the FIRE button is released.

Constructors
PCheckBox(checked)
Parameters
checked   the initial state of this checkbox