jMobileCore toolkit

com.jmobilecore.ui.core
Class Label

java.lang.Object
  extended by com.jmobilecore.ui.core.Component
      extended by com.jmobilecore.ui.core.Label
Direct Known Subclasses:
Checkbox, List, ListLabel, PropertyLabel, SimpleCheckbox

public class Label
extends Component

Provides a text label for display on the screen. A label is not focusable.

Author:
Greg Gridin

Field Summary
protected  java.lang.String text
          The text of this label.
 
Fields inherited from class com.jmobilecore.ui.core.Component
alignment, background, CENTER, focusable, focusedBackground, focusedForeground, font, foreground, height, isCompletelyVisible, isFocused, isVisible, LEFT, parentScreen, RIGHT, screenY, valid, width
 
Constructor Summary
Label(java.lang.String text)
          Constructs a new label with the specified string of text, left justified.
Label(java.lang.String text, javax.microedition.lcdui.Font font, int alignment)
          Constructs a new label that presents the specified string of text with the specified alignment.
Label(java.lang.String text, int alignment)
          Constructs a new label that presents the specified string of text with the specified alignment.
 
Method Summary
static Label createTitleLabel(java.lang.String titleText)
          Creates title label
 java.lang.String getText()
          Gets the text of this label.
 void paint(javax.microedition.lcdui.Graphics g)
          Paints the label to the screen.
 void setText(java.lang.String text)
          Sets the text for this label to the specified text.
 
Methods inherited from class com.jmobilecore.ui.core.Component
destructor, getBackground, getFont, getForeground, getHeight, getWidth, invalidate, isFocusOwner, keyPressed, keyReleased, keyRepeated, paintBackground, pointerDragged, pointerPressed, pointerReleased, prepareForeground, releaseFocus, requestFocus, setFont, setHeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected java.lang.String text
The text of this label.

See Also:
getText(), setText(String)
Constructor Detail

Label

public Label(java.lang.String text)
Constructs a new label with the specified string of text, left justified.

Parameters:
text - the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown. The text can be single line only. If text contains \n characters (used to indicate line breaks) then it might overlap with other UI components. It is up to the caller to ensure correctness of input string

Label

public Label(java.lang.String text,
             javax.microedition.lcdui.Font font,
             int alignment)
Constructs a new label that presents the specified string of text with the specified alignment. Possible values for alignment are Label.LEFT, Label.RIGHT, and Label.CENTER.

Parameters:
text - the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown. The text can be single line only. If text contains \n characters (used to indicate line breaks) then it might overlap with other UI components. It is up to the caller to ensure correctness of input string
font - the label font
alignment - the alignment value.

Label

public Label(java.lang.String text,
             int alignment)
Constructs a new label that presents the specified string of text with the specified alignment. Possible values for alignment are Label.LEFT, Label.RIGHT, and Label.CENTER.

Parameters:
text - the string that the label presents. A null value will be accepted without causing a NullPointerException to be thrown. The text can be single line only. If text contains \n characters (used to indicate line breaks) then it might overlap with other UI components. It is up to the caller to ensure correctness of input string
alignment - the alignment value.
Method Detail

createTitleLabel

public static Label createTitleLabel(java.lang.String titleText)
Creates title label

Parameters:
titleText - The title text
Returns:
title for current screen that could be uses with ScreenCanvas
See Also:
Label

getText

public java.lang.String getText()
Gets the text of this label.

Returns:
the text of this label, or null if the text has been set to null.
See Also:
setText(java.lang.String)

paint

public void paint(javax.microedition.lcdui.Graphics g)
Paints the label to the screen.

Overrides:
paint in class Component
Parameters:
g - The Graphics object to render to.

setText

public void setText(java.lang.String text)
Sets the text for this label to the specified text.

Parameters:
text - the text that this label displays.
See Also:
getText()

jMobileCore toolkit