jcontrol.ui.vole
Class Button

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

public class Button
extends Component

VOLE user interface labeled button. The application can cause some action to happen when the button is pushed.

(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
Button(Object label, int x, int y, int width, int height)
          Constructs a new button with text or an image.
Button(String label, int x, int y)
          Constructs a new text-labeled button.
 
Method Summary
 boolean onKeyEvent(KeyEvent e)
          If a KeyEvent accurs, this method is called.
 void paint()
          Paint the button.
 void press()
          Press the button.
 void setActionListener(ActionListener listener)
          Add an ActionListener to the button.
 void setLabel(Object label)
          Change the button's label
 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, setBounds, setFont, setGraphics, setParent, setVisible, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Constructor Detail

Button

public Button(String label,
              int x,
              int y)
Constructs a new text-labeled button. The button's width and height orient on the text extents.

Parameters:
text - The text to display on the button.
x - the x-coordinate of the button's top-left corner
y - the y-coordinate of the button's top-left corner

Button

public Button(Object label,
              int x,
              int y,
              int width,
              int height)
Constructs a new button with text or an image.

Parameters:
label - the label to display on the button
x - the x-coordinate of the button's top-left corner
y - the y-coordinate of the button's top-left corner
width - the width of the button
height - the height of the button
Method Detail

setLabel

public void setLabel(Object label)
Change the button's label

Parameters:
label - the new label or null if the button has no m_label.

press

public void press()
Press the button. An ActionEvent is fired.


paint

public void paint()
Paint the button.

Overrides:
paint in class Component

validate

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

Overrides:
validate in class Component

onKeyEvent

public boolean onKeyEvent(KeyEvent e)
If a KeyEvent accurs, this method is called.

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

setActionListener

public void setActionListener(ActionListener listener)
Add an ActionListener to the button. It will receive ActionEvents when the button is m_pressed.

Parameters:
listener - The new ActionListener or null.