mwt
Class Label

java.lang.Object
  extended by mwt.Component
      extended by mwt.Label

public class Label
extends Component

A label object is a component for displaying text or an image.

The text can be changed by the application, but the user cannot edit it directly.


Field Summary
static int STYLE_DEFAULT
          Constant value to get/set a skin/font.
static int STYLE_DISABLED
          Constant value to get/set a skin/font.
 
Fields inherited from class mwt.Component
ALIGN_BOTTOM_CENTER, ALIGN_BOTTOM_LEFT, ALIGN_BOTTOM_RIGHT, ALIGN_MIDDLE_CENTER, ALIGN_MIDDLE_LEFT, ALIGN_MIDDLE_RIGHT, ALIGN_TOP_CENTER, ALIGN_TOP_LEFT, ALIGN_TOP_RIGHT
 
Constructor Summary
Label(int x, int y, javax.microedition.lcdui.Image image)
          Creates a new image label.
Label(int x, int y, int width, int height, java.lang.String text)
          Creates a new text label.
 
Method Summary
static Font getDefaultFont(int style)
          Gets the default font for the given style.
 Font getFont(int style)
          Gets this label font for the given style.
 javax.microedition.lcdui.Image getImage()
          Gets the image, or null if this component is a text label.
 java.lang.String getText()
          Gets this label's text.
 int getTextAlign()
          Gets the text align.
protected  void paint(javax.microedition.lcdui.Graphics g, Window window)
          Paints this component.
static void setDefaultFont(int style, Font font)
          Sets the default font for the given style.
 void setFont(int style, Font font)
          Sets this label font for the given style.
 void setImage(javax.microedition.lcdui.Image image)
          Sets the image, or null if this component is a text label.
 void setText(java.lang.String text)
          Sets this label's text.
 void setTextAlign(int textAlign)
          Sets the text align.
 
Methods inherited from class mwt.Component
acceptsFocus, add, add, focusGained, focusLost, getChild, getChild, getChild, getChildCount, getComponent, getComponentCount, getComponentIndex, getHeight, getId, getParent, getWidth, getX, getY, isContainer, isDoubleBuffered, isEnabled, isFocusable, isHierarchyEnabled, isHierarchyVisible, isVisible, keyEvent, paintChilds, remove, removeChild, setDoubleBuffered, setEnabled, setFocusable, setHeight, setId, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_DEFAULT

public static final int STYLE_DEFAULT
Constant value to get/set a skin/font.

See Also:
Constant Field Values

STYLE_DISABLED

public static final int STYLE_DISABLED
Constant value to get/set a skin/font.

See Also:
Constant Field Values
Constructor Detail

Label

public Label(int x,
             int y,
             int width,
             int height,
             java.lang.String text)
Creates a new text label.


Label

public Label(int x,
             int y,
             javax.microedition.lcdui.Image image)
Creates a new image label. The initial width and height are defined by the given image size.

Method Detail

getDefaultFont

public static final Font getDefaultFont(int style)
Gets the default font for the given style.


setDefaultFont

public static final void setDefaultFont(int style,
                                        Font font)
Sets the default font for the given style.


getFont

public Font getFont(int style)
Gets this label font for the given style.


setFont

public void setFont(int style,
                    Font font)
Sets this label font for the given style.


getText

public java.lang.String getText()
Gets this label's text.


setText

public void setText(java.lang.String text)
Sets this label's text.


getTextAlign

public int getTextAlign()
Gets the text align. A Component ALIGN constant.


setTextAlign

public void setTextAlign(int textAlign)
Sets the text align. A Component ALIGN constant.


getImage

public javax.microedition.lcdui.Image getImage()
Gets the image, or null if this component is a text label.


setImage

public final void setImage(javax.microedition.lcdui.Image image)
Sets the image, or null if this component is a text label.

Since:
1.2

paint

protected void paint(javax.microedition.lcdui.Graphics g,
                     Window window)
Description copied from class: Component
Paints this component.

The default implementation calls Component.paintChilds(Graphics, Window).
An implementation should call Component.paintChilds(Graphics, Window) once (if the component is a container).

The graphics object was previously transformed to the current x and y, and the clip was setted according to this component width and height.

Overrides:
paint in class Component
Parameters:
g - the graphics to draw the component into
window - the window caller


Copyright © 2007 MWT-Team. All Rights Reserved.