|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.component.LabelField
public class 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 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 | ||
---|---|---|
AccessibleContext |
getAccessibleContext()
Returns accessible representation of the field for a screen reader. |
|
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(String 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. |
|
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 |
---|
public static final int DEFAULT_POSITION
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
,
StringBuffer
,
StringProvider
,
character array (char[]), or byte array (byte[]). It 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 which may be a String
,
StringBuffer
,
StringProvider
,
character array (char[]), or byte array (byte[]). It 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 which may be a String
,
StringBuffer
,
StringProvider
,
character array (char[]), or byte array (byte[]. It 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(ResourceBundleFamily rb, int key)
rb
- Resource bundle containing label text.key
- Key for resource containing label text.Method Detail |
---|
public boolean isSelectionCopyable()
isSelectionCopyable
in class Field
public int getPosition()
public int getPreferredHeight()
This field's manager invokes this method to assist in its layout.
getPreferredHeight
in class Field
public int getPreferredWidth()
Field.getPreferredWidth()
for more information.
This field's manager invokes this method to assist in its layout.
getPreferredWidth
in class Field
public 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.
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.
layout
in class Field
width
- Amount of available horizontal space.height
- Amount of available vertical space.protected void paint(Graphics graphics)
This field's manager invokes this method during the repainting process to instruct this field to repaint itself.
paint
in class Field
graphics
- Graphics context for repainting this field.public void selectionCopy(Clipboard cb)
selectionCopy
in class Field
cb
- 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(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.public void setText(ResourceBundleFamily rb, int key)
rb
- Resource bundle containing label text.key
- Key for resource containing label text.public String toString()
toString
in class Object
public AccessibleContext getAccessibleContext()
getAccessibleContext
in class Field
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.