Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## controlP5
Class ControlWindow

    java.lang.Object
      controlP5.ControlWindow

All Implemented Interfaces:
  java.awt.event.MouseWheelListener, java.awt.event.WindowFocusListener, java.util.EventListener

    public class ControlWindow

extends java.lang.Object
implements java.awt.event.MouseWheelListener, java.awt.event.WindowFocusListener

the purpose of a control window is to shift controllers from the main window into a separate 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. To constantly update the control window, use `ControlWindow.setUpdateMode(int)`

+Example
  `

      /**
       * ControlP5 ControlWindow
       * by andreas schlegel, 2012
       */

      import controlP5.*;

      ControlP5 cp5;

      int myColorBackground = color(0, 0, 0);

      ControlWindow controlWindow;

      public int sliderValue = 40;

      void setup() {
        size(700, 400);

        cp5 = new ControlP5(this);

        controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 400, 200)
          .hideCoordinates()
            .setBackground(color(40))
              ;

        cp5.addSlider("sliderValue")
          .setRange(0, 255)
            .setPosition(40, 40)
              .setSize(200, 29)
                .setWindow(controlWindow)
                  ;
      }

      void draw() {
        background(sliderValue);
      }

      void myTextfield(String theValue) {
        println(theValue);
      }

      void myWindowTextfield(String theValue) {
        println("from controlWindow: "+theValue);
      }

      void keyPressed() {
        if (key==',') cp5.window("controlP5window").hide();
        if (key=='.') cp5.window("controlP5window").show();
        // controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200);
        // controlP5.controller("sliderValue1").moveTo(controlWindow);

        if (key=='d') {
          if (controlWindow.isUndecorated()) {
            controlWindow.setUndecorated(false);
          }
          else {
            controlWindow.setUndecorated(true);
          }
        }
        if (key=='t') {
          controlWindow.toggleUndecorated();
        }
      }

  `

Nested Class Summary
`class` | `ControlWindow.Pointer` A pointer by default is linked to the mouse and stores the x and y position as well as the pressed and released state.

Field Summary
`int` | `background`
`static int` | `ECONOMIC`
`static int` | `NORMAL`

Method Summary
`ControlWindow` | `activateTab(java.lang.String theTab)`
`Tab` | `add(Tab theTab)`
`ControlWindow` | `addCanvas(ControlWindowCanvas theCanvas)`
`Tab` | `addTab(java.lang.String theTab)`
`ControlWindow` | `clear()` clear the control window, delete all controllers from a control window.
`java.awt.Component` | `component()`
`ControlWindow` | `disableMouseWheel()`
`ControlWindow` | `disablePointer()`
`ControlWindow` | `enableMouseWheel()`
`ControlWindow` | `enablePointer()`
`ControlWindow` | `frameRate(int theFrameRate)` sets the frame rate of the control window.
`Tab` | `getCurrentTab()`
`ControllerInterface` | `getFirstFromMouseOverList()`
`java.awt.Frame` | `getFrame()`
`java.util.List` | `getMouseOverList()` A list of controllers that are registered with a mouseover.
`ControlWindow.Pointer` | `getPointer()`
`processing.core.PVector` | `getPositionOfTabs()` Returns the position of the tab bar as PVector.
`Tab` | `getTab(java.lang.String theTabName)`
`ControllerList` | `getTabs()`
`ControlWindow` | `hide()` hide the controllers and tabs of the ControlWindow.
`ControlWindow` | `hideCoordinates()` hide the xy coordinates displayed in the title of a control window.
`boolean` | `isDrawBackground()`
`boolean` | `isMouseOver()` returns true if the mouse is inside a controller.
`boolean` | `isMouseOver(ControllerInterface theController)`
`boolean` | `isMousePressed()`
`boolean` | `isMouseWheel()`
`boolean` | `isUndecorated()`
`boolean` | `isUpdate()` check the update status of a control window.
`boolean` | `isVisible()`
`java.lang.String` | `name()` returns the name of the control window.
`ControlWindow` | `noSmooth()` disable smooth controlWindow rendering.
`processing.core.PApplet` | `papplet()` get the papplet instance of the ControlWindow.
`ControlWindow` | `pre()`
`void` | `remove()`
`ControlWindow` | `removeCanvas(ControlWindowCanvas theCanvas)`
`ControlWindow` | `removeMouseOverFor(ControllerInterface theController)`
`ControlWindow` | `removeTab(Tab theTab)`
`void` | `resetMouseOver()`
`ControlWindow` | `setBackground(int theValue)` set the background color of the control window.
`ControlWindow` | `setColorActive(int theColor)` set the color for the controller while active.
`ControlWindow` | `setColorBackground(int theColor)` set the background color of the controller.
`ControlWindow` | `setColorForeground(int theColor)` set the foreground color of the controller.
`ControlWindow` | `setColorLabel(int theColor)` set the color of the text label of the controller.
`ControlWindow` | `setColorValue(int theColor)` set the color of the values.
`ControlWindow` | `setContext(CDrawable theDrawable)` Adds a custom context to a ControlWindow.
`ControlWindow` | `setDrawBackground(boolean theFlag)` by default the background of a controlWindow is filled with a background color every frame.
`ControlWindow` | `setLocation(int theX, int theY)`
`ControlWindow` | `setPosition(int theX, int theY)`
`ControlWindow` | `setPositionOfTabs(int theX, int theY)`
`ControlWindow` | `setPositionOfTabs(processing.core.PVector thePVector)` Sets the position of the tab bar which is set to 0,0 by default.
`ControlWindow` | `setTitle(java.lang.String theTitle)` set the title of a control window.
`ControlWindow` | `setUndecorated(boolean theFlag)`
`void` | `setUpdate(boolean theFlag)` enable or disable the update function of a control window.
`ControlWindow` | `setUpdateMode(int theMode)` set the draw mode of a control window.
`ControlWindow` | `show()`
`ControlWindow` | `showCoordinates()` shows the xy coordinates displayed in the title of a control window.
`ControlWindow` | `smooth()` enable smooth controlWindow rendering.
`ControlWindow` | `toggleUndecorated()`
`void` | `windowGainedFocus(java.awt.event.WindowEvent e)`
`void` | `windowLostFocus(java.awt.event.WindowEvent e)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.awt.event.MouseWheelListener
`mouseWheelMoved`

Field Detail

### background

    public int background

### ECONOMIC

    public static final int ECONOMIC

See Also:
  Constant Field Values

### NORMAL

    public static final int NORMAL

See Also:
  Constant Field Values

Method Detail

### activateTab

    public ControlWindow activateTab(java.lang.String theTab)

### add

    public Tab add(Tab theTab)

### addCanvas

    public ControlWindow addCanvas(ControlWindowCanvas theCanvas)

### addTab

    public Tab addTab(java.lang.String theTab)

### clear

    public ControlWindow clear()

  clear the control window, delete all controllers from a control window.

### component

    public java.awt.Component component()

### disableMouseWheel

    public ControlWindow disableMouseWheel()

### disablePointer

    public ControlWindow disablePointer()

### enableMouseWheel

    public ControlWindow enableMouseWheel()

### enablePointer

    public ControlWindow enablePointer()

### frameRate

    public ControlWindow frameRate(int theFrameRate)

  sets the frame rate of the control window.

  Parameters:
    `theFrameRate` -
  Returns:
    ControlWindow

### getCurrentTab

    public Tab getCurrentTab()

### getFirstFromMouseOverList

    public ControllerInterface getFirstFromMouseOverList()

### getFrame

    public java.awt.Frame getFrame()

### getMouseOverList

    public java.util.List getMouseOverList()

  A list of controllers that are registered with a mouseover.

### getPointer

    public ControlWindow.Pointer getPointer()

### getPositionOfTabs

    public processing.core.PVector getPositionOfTabs()

  Returns the position of the tab bar as PVector. to move the tabs to y-position 100, use cp5.window().getPositionOfTabs().y = 100; or cp5.window().setPositionOfTabs(new PVector(0,100,0));

  Returns:
    PVector

### getTab

    public Tab getTab(java.lang.String theTabName)

### getTabs

    public ControllerList getTabs()

### hide

    public ControlWindow hide()

  hide the controllers and tabs of the ControlWindow.

### hideCoordinates

    public ControlWindow hideCoordinates()

  hide the xy coordinates displayed in the title of a control window. only applies to control windows of type PAppletWindow.

  Parameters:
    `theFlag` -

### isDrawBackground

    public boolean isDrawBackground()

### isMouseOver

    public boolean isMouseOver()

  returns true if the mouse is inside a controller. !!! doesnt work for groups yet.

### isMouseOver

    public boolean isMouseOver(ControllerInterface theController)

### isMousePressed

    public boolean isMousePressed()

### isMouseWheel

    public boolean isMouseWheel()

### isUndecorated

    public boolean isUndecorated()

### isUpdate

    public boolean isUpdate()

  check the update status of a control window.

### isVisible

    public boolean isVisible()

### name

    public java.lang.String name()

  returns the name of the control window.

### noSmooth

    public ControlWindow noSmooth()

  disable smooth controlWindow rendering.

### papplet

    public processing.core.PApplet papplet()

  get the papplet instance of the ControlWindow.

### pre

    public ControlWindow pre()

### remove

    public void remove()

### removeCanvas

    public ControlWindow removeCanvas(ControlWindowCanvas theCanvas)

### removeMouseOverFor

    public ControlWindow removeMouseOverFor(ControllerInterface theController)

### removeTab

    public ControlWindow removeTab(Tab theTab)

### resetMouseOver

    public void resetMouseOver()

### setBackground

    public ControlWindow setBackground(int theValue)

  set the background color of the control window.

### setColorActive

    public ControlWindow setColorActive(int theColor)

  set the color for the controller while active.

### setColorBackground

    public ControlWindow setColorBackground(int theColor)

  set the background color of the controller.

### setColorForeground

    public ControlWindow setColorForeground(int theColor)

  set the foreground color of the controller.

### setColorLabel

    public ControlWindow setColorLabel(int theColor)

  set the color of the text label of the controller.

### setColorValue

    public ControlWindow setColorValue(int theColor)

  set the color of the values.

### setContext

    public ControlWindow setContext(CDrawable theDrawable)

  Adds a custom context to a ControlWindow. Use a custom class which implements the CDrawable interface

  Parameters:
    `theDrawable` - CDrawable
  See Also:
    `CDrawable`

### setDrawBackground

    public ControlWindow setDrawBackground(boolean theFlag)

  by default the background of a controlWindow is filled with a background color every frame. to enable or disable the background from drawing, use setDrawBackgorund(true/false).

  Parameters:
    `theFlag` -
  Returns:
    ControlWindow

### setLocation

    public ControlWindow setLocation(int theX,
                                     int theY)

### setPosition

    public ControlWindow setPosition(int theX,
                                     int theY)

### setPositionOfTabs

    public ControlWindow setPositionOfTabs(int theX,
                                           int theY)

### setPositionOfTabs

    public ControlWindow setPositionOfTabs(processing.core.PVector thePVector)

  Sets the position of the tab bar which is set to 0,0 by default. to move the tabs to y-position 100, use cp5.window().setPositionOfTabs(new PVector(0,100,0));

  Parameters:
    `thePVector` -

### setTitle

    public ControlWindow setTitle(java.lang.String theTitle)

  set the title of a control window. only applies to control windows of type PAppletWindow.

### setUndecorated

    public ControlWindow setUndecorated(boolean theFlag)

### setUpdate

    public void setUpdate(boolean theFlag)

  enable or disable the update function of a control window.

### setUpdateMode

    public ControlWindow setUpdateMode(int theMode)

  set the draw mode of a control window. a separate control window is only updated when in focus. to update the context of the window continuously, use yourControlWindow.setUpdateMode(ControlWindow.NORMAL); otherwise use yourControlWindow.setUpdateMode(ControlWindow.ECONOMIC); for an economic, less cpu intensive update.

  Parameters:
    `theMode` -

### show

    public ControlWindow show()

### showCoordinates

    public ControlWindow showCoordinates()

  shows the xy coordinates displayed in the title of a control window. only applies to control windows of type PAppletWindow.

  Parameters:
    `theFlag` -

### smooth

    public ControlWindow smooth()

  enable smooth controlWindow rendering.

### toggleUndecorated

    public ControlWindow toggleUndecorated()

### windowGainedFocus

    public void windowGainedFocus(java.awt.event.WindowEvent e)

  Specified by:
    `windowGainedFocus` in interface `java.awt.event.WindowFocusListener`

### windowLostFocus

    public void windowLostFocus(java.awt.event.WindowEvent e)

  Specified by:
    `windowLostFocus` in interface `java.awt.event.WindowFocusListener`

Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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