|
|||||||||
| 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 |
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, READONLY, 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. |
||
| 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 family,
int id)
Sets this field's label text. |
|
String |
toString()
Returns a string representation of the object. |
|
| Methods inherited from class net.rim.device.api.ui.Field |
drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getChangeListener, getContextMenu, getCookie, getExtent, getFieldStyle, getFocusListener, getFocusRect, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getOriginal, getScreen, getStyle, getTop, getWidth, invalidate, invalidate, isDirty, isEditable, isFocusable, isMuddy, isPasteable, isSelectable, isSelecting, isSelectionCutable, isSelectionDeleteable, isVisible, keyChar, keyControl, keyDown, keyRepeat, keyStatus, keyUp, makeContextMenu, moveFocus, moveFocus, onFocus, onUnfocus, onVisibilityChange, paste, select, selectionCut, selectionDelete, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setFont, setMuddy, setPosition, trackwheelClick, trackwheelUnclick, updateLayout |
| 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: can be a String, StringBuffer, char[] or byte[]
(may be null for an empty label).IllegalArgumentException - if 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: can be a String, StringBuffer, char[] or byte[]
(may be null for an empty label).style - Style for this field.IllegalArgumentException - If text parameter is an unsupported
type.public LabelField(Object text, int offset, int length, long style)
text - Label text: can be a String, StringBuffer, char[] or byte[]
(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.| Method Detail |
public boolean isSelectionCopyable()
isSelectionCopyable in class Fieldpublic String getText()
Invoke this method to retrieve the value of this labe 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 void setPosition(int position)
position - Offset (in pixels) from left edge of this field.IllegalArgumentException - If position parameter is negative.public int getPosition()
public int getPreferredWidth()
This field's manager invokes this method to assist in its layout.
getPreferredWidth in class Fieldpublic int getPreferredHeight()
This field's manager invokes this method to assist in its layout.
getPreferredHeight 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 setText(Object text)
text - Label text: can be a String, StringBuffer, char[] or byte[]
(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: can be a String, StringBuffer, char[] or byte[]
(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 family, int id)
public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.