|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.ui.Field
|
+--net.rim.device.api.ui.component.LabelField
Contains a simple label.
Behaviour
Displays a label. Optionally focusable. Optionally can shorten text (with an
ellipsis) that is too long.
| Field Summary | ||
static int |
DEFAULT_POSITION
Default horizontal position. |
|
| Fields inherited from class net.rim.device.api.ui.Field |
ACTION_INVOKE, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH |
| Fields inherited from interface net.rim.device.api.ui.DrawStyle |
BASELINE, BOTTOM, ELLIPSIS, HALIGN_MASK, HCENTER, HDEFAULT, HFULL, LEADING, LEFT, RIGHT, TOP, TRAILING, TRUNCATE_BEGINNING, VALIGN_MASK, VCENTER, VDEFAULT, VFULL |
| Constructor Summary | ||
LabelField()
Constructs a new LabelField instance. |
||
LabelField(Object text)
Constructs a new LabelField instance with initial text. |
||
LabelField(Object text,
int offset,
int length,
long style)
Construct a new LabelField with provided style, and substring of provided text. |
||
LabelField(Object text,
long style)
Constructs a new LabelField with provided style. |
||
LabelField(ResourceBundleFamily rb,
int key)
Constructs a new LabelField instance with initial text from a resource bundle. |
||
| Method Summary | ||
int |
getPosition()
Retrieves drawing offset of this field's label text. |
|
int |
getPreferredHeight()
Retrieves this field's preferred height. |
|
int |
getPreferredWidth()
Retrieves this field's preferred width. |
|
String |
getText()
Retrieves this field's label text. |
|
boolean |
isSelectionCopyable()
Determines if this field is copyable. |
|
protected void |
layout(int width,
int height)
Lays out this field's contents. |
|
protected void |
paint(Graphics graphics)
Redraws this field. |
|
void |
selectionCopy(Clipboard cb)
Copies this field's label text to the clipboard. |
|
void |
setPosition(int position)
Sets horizontal drawing position for label text. |
|
void |
setText(Object text)
Sets this field's label text. |
|
void |
setText(Object text,
int offset,
int length)
Sets this field's label with substring of provided text. |
|
void |
setText(ResourceBundleFamily rb,
int key)
Sets this field's label text. |
|
void |
setText(String text,
int offset,
int length)
Sets this field's label with substring of provided text. |
|
String |
toString()
Retreives this field's text in a string. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
| Constructor Detail |
public LabelField()
Builds a new label field with no initial text.
public LabelField(Object text)
text - Label text which may be a string, string buffer, character
array, or byte array (may be null for an empty label).IllegalArgumentException - if text parameter is an unsupported
type.public LabelField(Object text, int offset, int length, long style)
text - Label text which may be a string, string buffer, character
array, or byte array (may be null for an empty label).offset - First character of text to use for the label.length - Number of characters to use for the label (specify -1 to use
the rest of the text after your offset).style - Style for this field.IllegalArgumentException - If offset parameter is negative or
beyond the end of the text parameter's length, if length parameter is
invalid, or text parameter is an unsupported type.public LabelField(Object text, long style)
Valid styles for a label field are:
Field.FOCUSABLE,
Field.USE_ALL_WIDTH,
DrawStyle.ELLIPSIS,
any of Field's horizontal or vertical alignment styles.
text - Label text which may be a string, string buffer, character
array, or byte array (may be null for an empty label).style - Style for this field.IllegalArgumentException - If text parameter is an unsupported
type.public LabelField(ResourceBundleFamily rb, int key)
rb - Resource bundle containing label text.key - Key for resource containing label text.| Method Detail |
public int getPosition()
public int getPreferredHeight()
Field.getPreferredHeight() for more information.
This field's manager invokes this method to assist in its layout.
getPreferredHeight in class Fieldpublic int getPreferredWidth()
Field.getPreferredWidth() for more information.
This field's manager invokes this method to assist in its layout.
getPreferredWidth in class Fieldpublic String getText()
Invoke this method to retrieve the value of this label field. If the label text was set to null, this method returns an empty string.
Note: this method may allocate a new String object each time you invoke it.
public boolean isSelectionCopyable()
isSelectionCopyable in class Field
protected void layout(int width,
int height)
This field's manager invokes this method during the layout process to instruct this field to arrange its contents, given an amount of available space.
width - Amount of available horizontal space.height - Amount of available vertical space.public void selectionCopy(Clipboard cb)
selectionCopy in class Fieldcb - Clipboard object to contain the clipped value from this field.public void setPosition(int position)
position - Offset (in pixels) from left edge of this field.IllegalArgumentException - If position parameter is negative.public void setText(Object text)
text - Label text which may be a string, string buffer, character
array, or byte array (may be null for an empty label).IllegalArgumentException - if text parameter is an unsupported
type.public void setText(Object text, int offset, int length)
text - Label text which may be a String, StringBuffer, char
array, or byte array (may be null for an empty label).offset - First character of text to use for label.length - Number of characters to use for label (provide -1 to mean
from offset to end of text parameter).IllegalArgumentException - if offset parameter is negative or
beyond the end of the text parameter's length, if length parameter is
invalid, or text parameter is an unsupported type.public void setText(ResourceBundleFamily rb, int key)
rb - Resource bundle containing label text.key - Key for resource containing label text.public void setText(String text, int offset, int length)
text - Label text which may be a Stringoffset - First character of text to use for label.length - Number of characters to use for label (provide -1 to mean
from offset to end of text parameter).IllegalArgumentException - if offset parameter is negative or
beyond the end of the text parameter's length, if length parameter is
invalid, or text parameter is an unsupported type.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.