jcontrol.ui.vole
Class Label

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--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) DOMOLOGIC Home Automation GmbH 2003

Author:
Wolfgang Klingauf

Field Summary
protected  int align
          Text alignment
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
protected  java.lang.Object label
          String or image ressource
 
Fields inherited from class jcontrol.ui.vole.Component
focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Label(java.lang.Object label, int x, int y)
          Construct a new label with x- and y-coordinate.
Label(java.lang.Object label, int x, int y, int width, int height, int align)
          Constructs a new label with specified bounds and alignment.
Label(java.lang.String text, 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(java.lang.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, setLocation, setParent, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, notifyAll, wait
 

Field Detail

align

protected int align
Text alignment


ALIGN_CENTER

public static final int ALIGN_CENTER
Align text to the middle

See Also:
Constant Field Values

ALIGN_LEFT

public static final int ALIGN_LEFT
Align text to the right

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Align text to the right

See Also:
Constant Field Values

label

protected java.lang.Object label
String or image ressource

Constructor Detail

Label

public Label(java.lang.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(java.lang.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

Label

public Label(java.lang.String text,
             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
Method Detail

paint

public void paint()
Paint the label.

Overrides:
paint in class Component

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.

setLabel

public void setLabel(java.lang.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.

transferFocus

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

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

validate

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

Overrides:
validate in class Component