jaron.pde
Class Slider

java.lang.Object
  extended by jaron.gui.Rect
      extended by jaron.gui.ActuatorXY
          extended by jaron.pde.Slider
All Implemented Interfaces:
SignalListener, java.util.EventListener

public class Slider
extends ActuatorXY

The Slider class provides a virtual slider for the Processing Development Environment (PDE).
Have a look at the example of the UAVsim for the usage of the Slider.

Since:
1.0
Version:
1.2
Author:
jarontec gmail com

Field Summary
 
Fields inherited from class jaron.gui.ActuatorXY
control
 
Constructor Summary
Slider(processing.core.PApplet applet, int left, int top)
          Creates a new Slider object for the Processing Development Environment (PDE).
Slider(processing.core.PApplet applet, int left, int top, int width, int height)
          Creates a new Slider object for the Processing Development Environment (PDE).
Slider(processing.core.PApplet applet, java.lang.String label, int left, int top)
          Creates a new Slider object for the Processing Development Environment (PDE).
Slider(processing.core.PApplet applet, java.lang.String label, int left, int top, int width, int height)
          Creates a new Slider object for the Processing Development Environment (PDE).
 
Method Summary
 void addSignalListener(SignalListener listener)
          Adds a listener to the slider.
 void draw()
          Draws the slider to the screen.
 Signal getSignal()
          Returns a Signal object containing a value that represents the current value of the slider.
 void setLabel(java.lang.String label)
          Sets the slider's label that is displayed at the right side.
 void setValue(double value)
          Sets the slider's value.
 
Methods inherited from class jaron.gui.ActuatorXY
addListenerX, addListenerY, getPowerSignal, getSignalX, getSignalY, getValueX, getValueY, isMouseOver, isMousePressed, mouseDragged, mouseMoved, mousePressed, mouseReleased, setBandwidthX, setBandwidthY, setControlSize, setLocation, setLockedX, setLockedY, setSize, setSpringX, setSpringY, setValueX, setValueY, signalChanged
 
Methods inherited from class jaron.gui.Rect
contains, createIntersection, getHeight, getLeft, getTop, getWidth, setHeight, setLeft, setTop, setWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slider

public Slider(processing.core.PApplet applet,
              java.lang.String label,
              int left,
              int top,
              int width,
              int height)
Creates a new Slider object for the Processing Development Environment (PDE).

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
label - the label that is displayed at right side
left - the component's position from the left
top - the component's position from top
height - the component's height
width - the component's width

Slider

public Slider(processing.core.PApplet applet,
              int left,
              int top,
              int width,
              int height)
Creates a new Slider object for the Processing Development Environment (PDE).

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
left - the component's position from the left
top - the component's position from top
height - the component's height
width - the component's width

Slider

public Slider(processing.core.PApplet applet,
              java.lang.String label,
              int left,
              int top)
Creates a new Slider object for the Processing Development Environment (PDE).

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
label - the label that is displayed at right side
left - the component's position from the left
top - the component's position from top

Slider

public Slider(processing.core.PApplet applet,
              int left,
              int top)
Creates a new Slider object for the Processing Development Environment (PDE).

Parameters:
applet - a reference to the PDE applet that provides the drawing environment
left - the component's position from the left
top - the component's position from top
Method Detail

addSignalListener

public void addSignalListener(SignalListener listener)
Adds a listener to the slider. In case of a change of the slider's value, all the listeners are informed through the EventListener mechanism.

Parameters:
listener - the listener to be added to slider
See Also:
SignalListener

draw

public void draw()
Draws the slider to the screen. This method should usually be called from the draw method of the Processing Development Environment. This ensures that the slider is updated periodically.


getSignal

public Signal getSignal()
Returns a Signal object containing a value that represents the current value of the slider.

Returns:
a Signal object containing the current y-axis value
See Also:
Signal

setLabel

public void setLabel(java.lang.String label)
Sets the slider's label that is displayed at the right side.

Parameters:
label - the label in short

setValue

public void setValue(double value)
Sets the slider's value.

Specified by:
setValue in interface SignalListener
Overrides:
setValue in class ActuatorXY
Parameters:
value - the new value
See Also:
Signal