controlP5
Class MultiListButton

java.lang.Object
  extended by controlP5.Controller
      extended by controlP5.Button
          extended by controlP5.MultiListButton
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants

public class MultiListButton
extends Button

Used by MultiList.

+Example
/**
 * ControlP5 MultiList
 * by andreas schlegel, 2009
 */

import controlP5.*;

ControlP5 controlP5;
MultiList l;

void setup() {
  size(700,400);
  frameRate(30);
  controlP5 = new ControlP5(this);
  
  // add a multiList to controlP5.
  // elements of the list have default dimensions
  // here, a width of 100 and a height of 12
  l = controlP5.addMultiList("myList",20,20,100,12);
  
  // create a multiListButton which we will use to
  // add new buttons to the multilist
  MultiListButton b;
  b = l.add("level1",1);
  
  // add items to a sublist of button "level1"
  b.add("level11",11).setLabel("level1 item1");
  b.add("level12",12).setLabel("level1 item2");

  b = l.add("level2",2);
  
  int cnt = 100;
  
  // add some more sublists.
  for(int i=0;i<10;i++) {
    MultiListButton c = b.add("level2"+(i+1),20+i+1);
    c.setLabel("level2 item"+(i+1));
    c.setColorBackground(color(64 + 18*i,0,0));
    
    if(i==4) {
    // changing the width and the height of a button
    // will be inherited by its sublists.
    c.setWidth(100);
    c.setHeight(20);
    }
    cnt++;
    
    if(i==4) {
      for(int j=0;j<10;j++) {
        cnt++;
        MultiListButton d;
        d = c.add("level2"+i+""+j,250+j+1);
        d.setLabel("level2 item"+(i+1)+" "+"item"+(j+1));
        d.setColorBackground(color(64 + 18*j,(64 + 18*j)/2,0));
        d.setId(cnt);
        d.setWidth(200);
      }
    }
  }
  
  MultiListButton cc = (MultiListButton)controlP5.controller("level21");
  cc.setHeight(40);
}


void controlEvent(ControlEvent theEvent) {
  println(theEvent.controller().name()+" = "+theEvent.value());  
  // uncomment the line below to remove a multilist item when clicked.
  // theEvent.controller().remove();
}


void draw() {
  background(0);
}

void keyPressed() {
  if(controlP5.controller("level23")!=null) {
    println("removing multilist button level23.");
    controlP5.controller("level23").remove();
  }
}

Field Summary
 
Fields inherited from class controlP5.Button
autoHeight, autoWidth
 
Fields inherited from class controlP5.Controller
autoSpacing
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ACTION_BROADCAST, ACTION_ENTER, ACTION_LEAVE, ACTION_PRESSED, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTIVE, ALL, ALT, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LEFT_OUTSIDE, LINE, LOAD, MENU, METHOD, MOVE, MULTI, MULTIPLES, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT
 
Method Summary
 MultiListButton add(java.lang.String theName, float theValue)
          add a new button to the sublist of this multilist button.
 void close()
           
 void close(controlP5.MultiListInterface theInterface)
           
 void draw(processing.core.PApplet theApplet)
           
 java.util.List getChildren()
          Deprecated. 
 int getDirection()
           
 void mouseReleasedOutside()
           
 java.lang.String name()
           
 boolean observe()
           
 void open()
           
 void remove()
          removes a controller from controlP5.
 MultiListButton setHeight(int theHeight)
          set the height of a multlist button.
 MultiListButton setWidth(int theWidth)
          set the width of a multlist button.
 MultiListButton toUpperCase(boolean theValue)
           
 void updateLocation(float theX, float theY)
           
 void updateRect(float theX, float theY, float theW, float theH)
           
 
Methods inherited from class controlP5.Button
activateBy, getBooleanValue, isOn, isPressed, setOff, setOn, setSwitch, setValue, update
 
Methods inherited from class controlP5.Controller
add, addCallback, addListener, align, bringToFront, bringToFront, changeValue, getAbsolutePosition, getAddress, getArrayValue, getArrayValue, getBehavior, getCaptionLabel, getColor, getControllerPlugList, getControlWindow, getDecimalPrecision, getDefaultValue, getHeight, getId, getLabel, getMax, getMin, getName, getParent, getPickingColor, getPointer, getPosition, getProperty, getProperty, getStringValue, getTab, getValue, getValueLabel, getWidth, getWindow, hide, init, isActive, isBroadcast, isInside, isLabelVisible, isListening, isLock, isMouseOver, isMousePressed, isMoveable, isUpdate, isVisible, keyEvent, linebreak, listen, listenerSize, lock, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, plugTo, plugTo, plugTo, plugTo, registerProperty, registerProperty, registerTooltip, remove, removeBehavior, removeCallback, removeCallback, removeListener, removeProperty, removeProperty, setAbsolutePosition, setAddress, setArrayValue, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColor, setColorActive, setColorBackground, setColorCaptionLabel, setColorForeground, setColorValueLabel, setDecimalPrecision, setDefaultValue, setGroup, setGroup, setId, setImage, setImage, setImages, setImages, setImages, setLabelVisible, setLock, setMax, setMin, setMouseOver, setMousePressed, setMoveable, setParent, setPosition, setPosition, setSize, setSize, setStringValue, setTab, setTab, setUpdate, setValueLabel, setView, setView, setVisible, show, unlock, unplugFrom, unplugFrom, unregisterTooltip, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface controlP5.ControllerInterface
continuousUpdateEvents, draw, parent, setColorLabel, setColorValue, setLabel
 
Methods inherited from interface controlP5.CDrawable
draw
 

Method Detail

add

public MultiListButton add(java.lang.String theName,
                           float theValue)
add a new button to the sublist of this multilist button.

Parameters:
theName - String
theValue - int
Returns:
MultiListButton

close

public void close()

close

public void close(controlP5.MultiListInterface theInterface)

getChildren

@Deprecated
public java.util.List getChildren()
Deprecated. 


getDirection

public int getDirection()

mouseReleasedOutside

public void mouseReleasedOutside()
Overrides:
mouseReleasedOutside in class Button

observe

public boolean observe()

open

public void open()

remove

public void remove()
Description copied from class: Controller
removes a controller from controlP5.

Specified by:
remove in interface ControllerInterface
Overrides:
remove in class Controller

setHeight

public MultiListButton setHeight(int theHeight)
set the height of a multlist button.

Overrides:
setHeight in class Controller
Parameters:
theHeight - int
Returns:
Controller

setWidth

public MultiListButton setWidth(int theWidth)
set the width of a multlist button.

Overrides:
setWidth in class Controller
Parameters:
theWidth - int
Returns:
Controller

toUpperCase

public MultiListButton toUpperCase(boolean theValue)

updateLocation

public void updateLocation(float theX,
                           float theY)

updateRect

public void updateRect(float theX,
                       float theY,
                       float theW,
                       float theH)

draw

public void draw(processing.core.PApplet theApplet)

name

public java.lang.String name()


processing library controlP5 by Andreas Schlegel. (c) 2006-2012