|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontrolP5.ControlWindow
public class ControlWindow
the purpose of a control window is to out-source controllers so that they dont need to be drawn into the actual processing window. to save cpu, a control window is not updated when not active - in focus. for the same reason the framerate is set to 15.
/** * ControlP5 ControlWindow * by andreas schlegel, 2009 */ import controlP5.*; ControlP5 controlP5; int myColorBackground = color(0,0,0); ControlWindow controlWindow; public int sliderValue = 40; void setup() { size(400,400); frameRate(25); controlP5 = new ControlP5(this); controlP5.setAutoDraw(false); controlWindow = controlP5.addControlWindow("controlP5window",100,100,400,200); controlWindow.hideCoordinates(); controlWindow.setBackground(color(40)); Controller mySlider = controlP5.addSlider("sliderValue",0,255,40,40,100,10); mySlider.setWindow(controlWindow); Textfield field = controlP5.addTextfield("myWindowTextfield",70,130,100,20); field.setWindow(controlWindow); controlP5.addSlider("sliderValue1",0,255,40,40,100,10); controlP5.addTextfield("myTextfield",70,130,40,20); controlWindow.setTitle("abc"); } void draw() { background(sliderValue); controlP5.draw(); } void myTextfield(String theValue) { println(theValue); } void myWindowTextfield(String theValue) { println("from controlWindow: "+theValue); } void keyPressed() { if(key==',') controlP5.window("controlP5window").hide(); if(key=='.') controlP5.window("controlP5window").show(); // controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200); // controlP5.controller("sliderValue1").moveTo(controlWindow); // since version 0.5.0, a controlWindow can be set undecorated. if(key=='d') { if(controlWindow.isUndecorated()) { controlWindow.setUndecorated(false); } else { controlWindow.setUndecorated(true); } } if(key=='t') { controlWindow.toggleUndecorated(); } }
Field Summary | |
---|---|
int |
background
|
static int |
ECONOMIC
|
static int |
NORMAL
|
Constructor Summary | |
---|---|
ControlWindow(ControlP5 theControlP5,
processing.core.PApplet theApplet)
|
Method Summary | |
---|---|
void |
activateTab(java.lang.String theTab)
activate a tab of a control window. |
Tab |
add(Tab theTab)
add a tab to the control window. |
void |
addCanvas(ControlWindowCanvas theCanvas)
|
Tab |
addTab(java.lang.String theTab)
|
void |
clear()
clear the control window, delete all controllers from a control window. |
java.awt.Component |
component()
|
Tab |
currentTab()
get the current active tab of a control window. |
void |
draw()
|
void |
frameRate(int theFrameRate)
set the frame rate of the control window. |
void |
hide()
hide the controllers and tabs of the ControlWindow. |
void |
hideCoordinates()
hide the xy coordinates displayed in the title of a control window. |
boolean |
isDrawBackground()
returns a boolean indicating if the background is drawn automatically or not. |
boolean |
isMouseOver()
returns true if the mouse is inside a controller. |
boolean |
isMousePressed()
|
boolean |
isUndecorated()
|
boolean |
isUpdate()
check the update status of a control window. |
boolean |
isVisible()
check if the content of the control window is visible. |
void |
keyEvent(java.awt.event.KeyEvent theKeyEvent)
|
void |
mouseEvent(java.awt.event.MouseEvent theMouseEvent)
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
|
void |
multitouch(int[][] theCoordinates)
|
java.lang.String |
name()
get the name of the control window. |
processing.core.PApplet |
papplet()
get the papplet instance of the ControlWindow. |
void |
pre()
|
void |
remove()
remove a control window from controlP5. |
void |
removeCanvas(ControlWindowCanvas theCanvas)
|
void |
removeTab(Tab theTab)
remove a tab from a control window. |
void |
setBackground(int theValue)
set the background color of the control window. |
void |
setColorActive(int theColor)
set the color for the controller while active. |
void |
setColorBackground(int theColor)
set the background color of the controller. |
void |
setColorForeground(int theColor)
set the foreground color of the controller. |
void |
setColorLabel(int theColor)
set the color of the text label of the controller. |
void |
setColorValue(int theColor)
set the color of the values. |
void |
setContext(CDrawable theDrawable)
|
void |
setDrawBackground(boolean theFlag)
by default the background of a controlWindow is filled with a backgorund color every frame. |
void |
setLocation(int theX,
int theY)
|
void |
setMode(int theMode)
Deprecated. |
void |
setTitle(java.lang.String theTitle)
set the title of a control window. |
void |
setUndecorated(boolean theFlag)
|
void |
setUpdate(boolean theFlag)
enable or disable the update function of a control window. |
void |
setUpdateMode(int theMode)
set the draw mode of a control window. |
void |
show()
show the controllers and tabs of the ControlWindow. |
void |
showCoordinates()
shows the xy coordinates displayed in the title of a control window. |
Tab |
tab(java.lang.String theTabName)
get a tab by name of a control window |
ControllerList |
tabs()
|
void |
toggleUndecorated()
|
void |
update()
update all controllers contained in the control window if update is enabled. |
void |
updateEvents()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int background
public static final int NORMAL
public static final int ECONOMIC
Constructor Detail |
---|
public ControlWindow(ControlP5 theControlP5, processing.core.PApplet theApplet)
theControlP5
- ControlP5theApplet
- PAppletMethod Detail |
---|
public Tab currentTab()
public void activateTab(java.lang.String theTab)
theTab
- Stringpublic void removeTab(Tab theTab)
theTab
- Tabpublic Tab add(Tab theTab)
theTab
- Tab
public Tab addTab(java.lang.String theTab)
public ControllerList tabs()
public Tab tab(java.lang.String theTabName)
theTabName
- String
public void remove()
public void clear()
public void updateEvents()
public boolean isMouseOver()
public void update()
public void setUpdate(boolean theFlag)
theFlag
- booleanpublic boolean isUpdate()
public void addCanvas(ControlWindowCanvas theCanvas)
public void removeCanvas(ControlWindowCanvas theCanvas)
public void pre()
public void draw()
public void setContext(CDrawable theDrawable)
theDrawable
- CDrawablepublic java.lang.String name()
public void mouseEvent(java.awt.event.MouseEvent theMouseEvent)
theMouseEvent
- MouseEventpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public void multitouch(int[][] theCoordinates)
public boolean isMousePressed()
public void keyEvent(java.awt.event.KeyEvent theKeyEvent)
theKeyEvent
- KeyEventpublic void setColorActive(int theColor)
theColor
- intpublic void setColorForeground(int theColor)
theColor
- intpublic void setColorBackground(int theColor)
theColor
- intpublic void setColorLabel(int theColor)
theColor
- intpublic void setColorValue(int theColor)
theColor
- intpublic void setBackground(int theValue)
theValue
- intpublic processing.core.PApplet papplet()
public java.awt.Component component()
public void setTitle(java.lang.String theTitle)
public void showCoordinates()
theFlag
- public void hideCoordinates()
theFlag
- public void hide()
public void setMode(int theMode)
theMode
- public void setUpdateMode(int theMode)
theMode
- public void frameRate(int theFrameRate)
theFrameRate
- public void show()
public void setDrawBackground(boolean theFlag)
theFlag
- public boolean isDrawBackground()
public boolean isVisible()
public void toggleUndecorated()
public void setUndecorated(boolean theFlag)
public boolean isUndecorated()
public void setLocation(int theX, int theY)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |