public class MultiListButton extends Button
/**
* 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();
}
}
autoHeight, autoWidth
autoSpacing
acceptClassList, ACTION_BROADCAST, ACTION_CLICK, ACTION_DRAG, ACTION_ENTER, ACTION_EXIT, ACTION_LEAVE, ACTION_MOVE, ACTION_PRESS, ACTION_PRESSED, ACTION_RELEASE, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTION_WHEEL, ACTIVE, ALL, ALT, AQUA, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BLACK, BLUE, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, CHECKBOX, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, DROPDOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, FUCHSIA, GRAY, GREEN, grixel, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, J2D, KEYCONTROL, LEFT, LEFT_OUTSIDE, LIME, LINE, LIST, LOAD, MAROON, MENU, METHOD, MOVE, MULTI, MULTIPLES, NAVY, OLIVE, ORANGE, OVER, P2D, P3D, PI, PRESSED, PRINT, PURPLE, RED, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SILVER, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, standard56, standard58, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, synt24, TAB, TEAL, THEME_A, THEME_CP52014, THEME_CP5BLUE, THEME_RED, THEME_RETRO, THEME_WHITE, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TREE, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT, WHITE, YELLOW
Modifier and Type | Method and Description |
---|---|
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.PGraphics theGraphics) |
java.util.List<MultiListButton> |
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) |
activateBy, getBooleanValue, getInfo, isOn, isPressed, mousePressed, mouseReleased, setOff, setOn, setSwitch, setValue, toString, update, updateDisplayMode, updateViewMode
add, addCallback, addListener, align, bringToFront, bringToFront, changeValue, continuousUpdateEvents, draw, 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, getView, getWidth, getWindow, hide, init, isActive, isBroadcast, isInside, isLabelVisible, isListening, isLock, isMouseOver, isMousePressed, isMoveable, isUpdate, isUserInteraction, 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, setUserInteraction, setValueLabel, setValueSelf, setView, setView, setVisible, show, unlock, unplugFrom, unplugFrom, unregisterTooltip, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
parent, setColorLabel, setColorValue, setLabel
public MultiListButton add(java.lang.String theName, float theValue)
theName
- StringtheValue
- intpublic void close()
public void close(controlP5.MultiListInterface theInterface)
@Deprecated public java.util.List<MultiListButton> getChildren()
public int getDirection()
public void mouseReleasedOutside()
mouseReleasedOutside
in class Button
public boolean observe()
public void open()
public void remove()
Controller
remove
in interface ControllerInterface<Button>
remove
in class Controller<Button>
public MultiListButton setHeight(int theHeight)
setHeight
in class Controller<Button>
theHeight
- intpublic MultiListButton setWidth(int theWidth)
setWidth
in class Controller<Button>
theWidth
- intpublic MultiListButton toUpperCase(boolean theValue)
public void updateLocation(float theX, float theY)
public void updateRect(float theX, float theY, float theW, float theH)
public void draw(processing.core.PGraphics theGraphics)
public java.lang.String name()
processing library controlP5 by Andreas Schlegel. (c) 2006-2014