예제 #1
0
 public void controlEvent(ControlEvent theEvent) {
   // select com from list
   if (theEvent.isGroup() && theEvent.name().equals("portComList")) {
     println("Select portComList" + "   value = " + theEvent.group().value()); // for debugging
     InitSerial(theEvent.group().value()); // initialize the serial port selected
   }
 }
예제 #2
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void controlEvent(ControlEvent theEvent) {
    // PulldownMenu is if type ControlGroup.
    // A controlEvent will be triggered from within the ControlGroup.
    // therefore you need to check the originator of the Event with
    // if (theEvent.isGroup())
    // to avoid an error message from controlP5.
    if (theEvent.isGroup()) {
      if (theEvent.group().name() == "ruleChoiceList") {
        //    println(theEvent.group().value()+" from "+theEvent.group());
        selectedRule = PApplet.parseInt(theEvent.group().value());
        // has to be here for the controlp5 library
      }
    } else if (theEvent.isController()) {
      //    println(theEvent.controller().value()+" from "+theEvent.controller());
    }

    //  switch(theEvent.controller().id()) {
    //    case(1):
    //    myColorRect = (int)(theEvent.controller().value());
    //    break;
    //    case(2):
    //    myColorBackground = (int)(theEvent.controller().value());
    //    break;
    //    case(3):
    //    println(theEvent.controller().stringValue());
    //    break;
    //  }

  }
예제 #3
0
 public void controlEvent(ControlEvent theEvent) {
   if (theEvent.isGroup()) {
     if (theEvent.group().name() == "optionsbox") {
       for (int i = 0; i < theEvent.group().arrayValue().length; i++) {
         optionsArray[i] = (int) theEvent.group().arrayValue()[i];
       }
       if (optionsArray[0] == 1) {
         translator = true;
       } else {
         translator = false;
       }
     }
   }
 }