jcontrol.ui.vole
Class NumberChooser

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

public class NumberChooser
extends Component

The class NumberChosser implements a label showing a number. The number can be changed by an up-down button.
When the user changes the state, an ActionEvent of type VALUE_CHANGED is fired.

(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
NumberChooser(int x, int y, int min, int max)
           
 
Method Summary
 int getValue()
          Returns the currently selected value.
 boolean onKeyEvent(KeyEvent e)
          Handle key events.
 void paint()
          Paint this ComboBox.
 void setActionListener(ActionListener listener)
          Sets an ActionListener for the ComboBox.
 void setBounds(int x, int y, int width, int height)
          Set the dimensions of this component.
 void setFont(Resource font)
          Sets the font for this component.
 void setValue(int value)
          Sets the specified value.
 void validate()
          Compute this component's preferred size and assign internal values width and height.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, remove, removeFocus, requestFocus, setGraphics, setParent, setVisible, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Constructor Detail

NumberChooser

public NumberChooser(int x,
                     int y,
                     int min,
                     int max)
Method Detail

setFont

public void setFont(Resource font)
Sets the font for this component.

Overrides:
setFont in class Component
Parameters:
font - The new font.

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Set the dimensions of this component. The component is repainted automatically.

Overrides:
setBounds in class Component
Parameters:
x - x coordinate of the upper left corner
y - y coordinate of the upper left corner
width - The width of this component
height - The height of this component (this parameter is ignored)

setValue

public void setValue(int value)
Sets the specified value. The value must be within the range specified for this NumberChooser.

Parameters:
v - the value to set

getValue

public int getValue()
Returns the currently selected value.


paint

public void paint()
Paint this ComboBox.

Overrides:
paint in class Component

setActionListener

public void setActionListener(ActionListener listener)
Sets an ActionListener for the ComboBox. It will receive ActionEvents everytime a combo box item is pressed.

Parameters:
listener - The ActionListener to assign to this ComboBox.

onKeyEvent

public boolean onKeyEvent(KeyEvent e)
Handle key events. On several user actions, an ActionEvent is fired.

Overrides:
onKeyEvent in class Component
Parameters:
e - the KeyEvent
Returns:
If this method returns true, the KeyEvent is handled by the super Container.

validate

public void validate()
Compute this component's preferred size and assign internal values width and height.

Overrides:
validate in class Component