jcontrol.ui.wombat
Class Label

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

public class Label
extends Component

A label is a very simple component which displays a one or more lines of read-only text or an image. 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_INVERSE
          Inverse mode
static int STYLE_DRAW_NORMAL
          Normal (non-inverse) mode
static int STYLE_SHOW_BORDER
          Paint a border around the label
 
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
Label(Resource image, int x, int y)
          Construct a new label.
Label(Resource image, int x, int y, int width, int height, int style)
          Constructs a new label with specified bounds and alignment.
Label(String text, int x, int y)
          Construct a new label.
Label(String text, int x, int y, int width, int height, int style)
          Constructs a new label with specified bounds and alignment.
 
Method Summary
 Object getLabel()
          Returns the caption of this label which is either a string or a resource representing an image.
 void paint(XGraphics g)
          Paint the label.
 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 setImage(Resource image)
          Replaces the current text or image on this label by the specified image.
 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.
protected  int validateBreakPoints(XGraphics g)
           
 
Methods inherited from class jcontrol.ui.wombat.Component
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setDirty, setEnabled, setForegroundColor, setForegroundColorInternal, setParametersInternal, 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_INVERSE

public static final int STYLE_DRAW_INVERSE
Inverse mode

See Also:
Constant Field Values

STYLE_SHOW_BORDER

public static final int STYLE_SHOW_BORDER
Paint a border around the label

See Also:
Constant Field Values

STYLE_DRAW_NORMAL

public static final int STYLE_DRAW_NORMAL
Normal (non-inverse) mode

See Also:
Constant Field Values
Constructor Detail

Label

public Label(String text,
             int x,
             int y)
Construct a new label. The size will be calculated as big as is fits the given text.

Parameters:
text - a text 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(Resource image,
             int x,
             int y)
Construct a new label. The size will be calculated as big as is fits the given image.

Parameters:
image - an image 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 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

Label

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

Parameters:
image - the image 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

setImage

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

Parameters:
image - the new image to set.

getLabel

public Object getLabel()
Returns the caption of this label which is either a string or a resource representing an image.

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

setFont

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

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

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

validateBreakPoints

protected int validateBreakPoints(XGraphics g)

paint

public void paint(XGraphics g)
Paint the label. Don't call this method directly.

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