jcontrol.ui.vole
Class Slider

java.lang.Object
  extended by jcontrol.ui.vole.Component
      extended by jcontrol.ui.vole.Slider

public class Slider
extends Component

This is a graphical slider for JControl. The slider can be moved virtually left or right to simulate analog input.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Field Summary
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Slider(int x, int y, int width, int min, int max)
          Constructs a slider and sets bounds.
Slider(int x, int y, int width, int min, int max, int step)
          Constructs a slider and sets bounds.
 
Method Summary
 int getValue()
          Get slider value.
 boolean onKeyEvent(KeyEvent event)
          Handle KeyEvents.
 void paint()
          Repaint the Slider.
 void setActionListener(ActionListener listener)
          Add an ActionListener to the button.
 void setValue(int value)
          Set the slider value.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, remove, removeFocus, requestFocus, setBounds, setFont, setGraphics, setParent, setVisible, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Constructor Detail

Slider

public Slider(int x,
              int y,
              int width,
              int min,
              int max)
Constructs a slider and sets bounds.

Parameters:
x - the upper left x coordinate.
y - the upper left y coordinate.
min - the slider's minimum value (>= 0)
max - the slider's maximum value.
step - slider value is incremented by step when KEY_SELECT is activated

Slider

public Slider(int x,
              int y,
              int width,
              int min,
              int max,
              int step)
Constructs a slider and sets bounds.

Parameters:
x - the upper left x coordinate.
y - the upper left y coordinate.
min - the slider's minimum value (>= 0)
max - the slider's maximum value.
step - slider value is incremented by step when KEY_SELECT is activated
Method Detail

setValue

public void setValue(int value)
Set the slider value.

Parameters:
value - The new value.

getValue

public int getValue()
Get slider value.

Returns:
int The current value.

paint

public void paint()
Repaint the Slider.

Overrides:
paint in class Component

setActionListener

public void setActionListener(ActionListener listener)
Add an ActionListener to the button. It will receive ActionEvents when the slider is moved. The current value is represented as String and can be read using the ActionEvent.getActionCommand() method.

Parameters:
listener - The new ActionListener or null.

onKeyEvent

public boolean onKeyEvent(KeyEvent event)
Handle KeyEvents.

Overrides:
onKeyEvent in class Component
Parameters:
event - the KeyEvent
Returns:
If this method returns true, the KeyEvent is handled by the super Container.
See Also:
Component.onKeyEvent(KeyEvent)