jcontrol.ui.wombat
Class FastLabel

java.lang.Object
  extended by jcontrol.ui.wombat.Component
      extended by jcontrol.ui.wombat.FastLabel

public class FastLabel
extends Component

A label is a very simple component which displays a single line of read-only text or an image resource. The text can be changed by the application, but a user cannot edit it directly.
Labels are passive components, they can neither be selected nor fire any events.

(c) Copyright 2005-2007 DOMOLOGIC GmbH


Field Summary
static int STYLE_ALIGN_CENTER
          Align text to the middle
static int STYLE_ALIGN_LEFT
          Align text to the left
static int STYLE_ALIGN_RIGHT
          Align text to the right
static int STYLE_DRAW_NORMAL
          Inverse mode
 
Fields inherited from class jcontrol.ui.wombat.Component
backgroundColor, COLOR_COMPONENT_BACKGROUND, COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED, COLOR_COMPONENT_DARK_SHADOW, COLOR_COMPONENT_FOREGROUND, COLOR_COMPONENT_FOREGROUND_INACTIVE, COLOR_COMPONENT_HIGHLIGHT_SHADOW, COLOR_COMPONENT_LIGHT_SHADOW, COLOR_COMPONENT_LIST_BACKGROUND, COLOR_COMPONENT_NORMAL_SHADOW, COLOR_COMPONENT_SELECTION_TEXT, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE, COLOR_COMPONENT_SELECTION_TEXT_INACTIVE, eventQueue, font, foregroundColor, frame, height, parent, RESERVED1, RESERVED2, RESERVED3, RESERVED4, RESERVED5, RESERVED6, state, STATE_ABORT_UPDATE, STATE_ANIMATED, STATE_BG_COLOR_SET, STATE_COVERED, STATE_DIRTY_MASK, STATE_DIRTY_PAINTALL, STATE_DIRTY_REPAINT, STATE_DIRTY_UPDATE, STATE_DISABLED, STATE_DISPOSED, STATE_FG_COLOR_SET, STATE_FOCUS, STATE_HEIGHT_FIXED, STATE_NO_REDRAW, STATE_REVALIDATE, STATE_SELECTED, STATE_SIZE_FIXED, STATE_UPDATED, STATE_VISIBLE, STATE_WIDTH_FIXED, transparentColor, width, x, y
 
Constructor Summary
FastLabel(String text, int x, int y, int width, int height, int style)
          Constructs a new label with specified bounds and alignment.
 
Method Summary
 String getLabel()
          Returns the caption of this label.
 void paint(XGraphics g)
          Paint the label.
 void setBackgroundColor(Color background)
          Sets the background color for this component.
protected  void setBackgroundColorInternal(Color background)
           
 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 setForegroundColor(Color foreground)
          Sets the foreground color for this component.
protected  void setForegroundColorInternal(Color foreground)
           
protected  void setParametersInternal(Resource font, Color foregroundColor, Color backgroundColor, Color transparentColor)
           
 void setStyle(int style)
          Sets the style of the label.
 void setText(String text)
          Replaces the current text or image on this label by the specified text.
 
Methods inherited from class jcontrol.ui.wombat.Component
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setDirty, setEnabled, setRedraw, setTransparentColor, setVisible, unsafeExec, update
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notifyAll, toString, wait
 

Field Detail

STYLE_ALIGN_LEFT

public static final int STYLE_ALIGN_LEFT
Align text to the left

See Also:
Constant Field Values

STYLE_ALIGN_CENTER

public static final int STYLE_ALIGN_CENTER
Align text to the middle

See Also:
Constant Field Values

STYLE_ALIGN_RIGHT

public static final int STYLE_ALIGN_RIGHT
Align text to the right

See Also:
Constant Field Values

STYLE_DRAW_NORMAL

public static final int STYLE_DRAW_NORMAL
Inverse mode

See Also:
Constant Field Values
Constructor Detail

FastLabel

public FastLabel(String text,
                 int x,
                 int y,
                 int width,
                 int height,
                 int style)
Constructs a new label with specified bounds and alignment.

Parameters:
text - the text 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
style - the alignment and style of the label. Possible values are one of the styles STYLE_ALIGN_LEFT, STYLE_ALIGN_CENTER or STYLE_ALIGN_RIGHT and optional STYLE_DRAW_INVERSE and STYLE_SHOW_BORDER
Method Detail

setText

public void setText(String text)
Replaces the current text or image on this label by the specified text. The size will be re-calculated if it has not been specified with the setBounds()-method or in the constructor.

Parameters:
text - the new text

setBackgroundColor

public void setBackgroundColor(Color background)
Description copied from class: Component
Sets the background color for this component.

Overrides:
setBackgroundColor in class Component
Parameters:
background - the background color to set

setBackgroundColorInternal

protected void setBackgroundColorInternal(Color background)
Overrides:
setBackgroundColorInternal in class Component

setFont

public void setFont(Resource font)
Description copied from class: Component
Sets the font for this component.

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

setForegroundColor

public void setForegroundColor(Color foreground)
Description copied from class: Component
Sets the foreground color for this component.

Overrides:
setForegroundColor in class Component
Parameters:
foreground - the foreground color to set

setForegroundColorInternal

protected void setForegroundColorInternal(Color foreground)
Overrides:
setForegroundColorInternal in class Component

setParametersInternal

protected void setParametersInternal(Resource font,
                                     Color foregroundColor,
                                     Color backgroundColor,
                                     Color transparentColor)
Overrides:
setParametersInternal in class Component

getLabel

public String getLabel()
Returns the caption of this label.

Returns:
the caption of this label.

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 - The x-coordinate of the upper left corner
y - The y-coordinate of the upper left corner
width - The width of this component
height - The height of this component

setStyle

public void setStyle(int style)
Sets the style of the label.

Parameters:
style - the alignment and style of the label. Possible values are one of the styles STYLE_ALIGN_LEFT, STYLE_ALIGN_CENTER or STYLE_ALIGN_RIGHT and optional STYLE_DRAW_INVERSE and STYLE_SHOW_BORDER

paint

public void paint(XGraphics g)
Paint the label.

Overrides:
paint in class Component
Parameters:
g - the application's graphics object.