jcontrol.ui.vole
Class Label

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

public class Label
extends Component

A label is a very simple component which displays non-editable text or an image resource. Labels cannot gain the input focus.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Field Summary
static int ALIGN_CENTER
          Align text to the middle
static int ALIGN_LEFT
          Align text to the right
static int ALIGN_RIGHT
          Align text to the right
 
Fields inherited from class jcontrol.ui.vole.Component
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Label(Object label, int x, int y)
          Construct a new label with x- and y-coordinate.
Label(Object label, int x, int y, int width, int height, int align)
          Constructs a new label with specified bounds and alignment.
Label(String label, int x, int y, int align)
          Construct a new label with specified alignment.
 
Method Summary
 void paint()
          Paint the label.
 void setAlign(int align, boolean revalidate)
          Set the alignment of the label.
 void setLabel(Object label, boolean revalidate)
          Set a new label to display.
 boolean transferFocus()
          Label can't gain input focus.
 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, onKeyEvent, remove, removeFocus, requestFocus, setBounds, setFont, setGraphics, setParent, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

ALIGN_LEFT

public static final int ALIGN_LEFT
Align text to the right

See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
Align text to the middle

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Align text to the right

See Also:
Constant Field Values
Constructor Detail

Label

public Label(Object label,
             int x,
             int y)
Construct a new label with x- and y-coordinate.

Parameters:
label - A String or an image resource to print on the label.
x - the x-coordinate of the label's top-left corner
y - the y-coordinate of the label's top-left corner

Label

public Label(String label,
             int x,
             int y,
             int align)
Construct a new label with specified alignment.

Parameters:
text - A String or an image resource to print on the label.
x - the x-coordinate of the label's top-left corner
y - the y-coordinate of the label's top-left corner
align - the horizontal alignment of the text. Possible values are ALIGN_LEFT, ALIGN_CENTER and ALIGN_RIGHT

Label

public Label(Object label,
             int x,
             int y,
             int width,
             int height,
             int align)
Constructs a new label with specified bounds and alignment.

Parameters:
label - the label to display on the label
x - the x-coordinate of the label's top-left corner
y - the y-coordinate of the label's top-left corner
width - the width of the label
height - the height of the label
align - the horizontal alignment of the label. Possible values are ALIGN_LEFT, ALIGN_CENTER and ALIGN_RIGHT
Method Detail

setLabel

public void setLabel(Object label,
                     boolean revalidate)
Set a new label to display.

Parameters:
label - The new label (string or image resource).
revalidate - If true, the display area will be cleared before repainting.

setAlign

public void setAlign(int align,
                     boolean revalidate)
Set the alignment of the label.

Parameters:
align - The horizontal alignment of the label.
revalidate - If true, the display area will be cleared before repainting.

paint

public void paint()
Paint the label.

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

transferFocus

public boolean transferFocus()
Label can't gain input focus.

Overrides:
transferFocus in class Component
Returns:
true, if the focus was transferred successfully.