|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.StringItem
public class StringItem
An item that can contain a string.
A StringItem is display-only; the user
cannot edit the contents. Both the label and the textual content of a
StringItem may be modified by the application. The
visual representation
of the label may differ from that of the textual contents.
| Field Summary | |
|---|---|
protected boolean |
animateTextWrap
|
protected BitMapFont |
bitMapFont
|
protected BitMapFontViewer |
bitMapFontViewer
|
protected boolean |
clipText
|
protected javax.microedition.lcdui.Font |
font
|
protected java.lang.String |
text
|
protected int |
textColor
|
protected TextEffect |
textEffect
|
protected int |
textHorizontalAdjustment
|
protected java.lang.String[] |
textLines
|
protected int |
textVerticalAdjustment
|
protected int |
textWrapDirection
|
protected int |
textWrapSpeed
|
protected boolean |
useSingleLine
|
protected int |
xOffset
|
| Constructor Summary | |
|---|---|
StringItem(java.lang.String label,
java.lang.String text)
Creates a new StringItem object. |
|
StringItem(java.lang.String label,
java.lang.String text,
int appearanceMode)
Creates a new StringItem object with the given label,
textual content, and appearance mode. |
|
StringItem(java.lang.String label,
java.lang.String text,
int appearanceMode,
Style style)
Creates a new StringItem object with the given label,
textual content, and appearance mode. |
|
StringItem(java.lang.String label,
java.lang.String text,
Style style)
Creates a new StringItem object. |
|
| Method Summary | |
|---|---|
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
protected java.lang.String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected void |
defocus(Style originalStyle)
Removes the focus from this item. |
javax.microedition.lcdui.Font |
getFont()
Gets the application's preferred font for rendering this StringItem. |
int |
getFontHeight()
Retrieves the height necessary for displaying a row of text without the padding-vertical. |
java.lang.String |
getText()
Gets the text contents of the StringItem, or
null if the StringItem is
empty. |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this item. |
void |
setFont(javax.microedition.lcdui.Font font)
Sets the application's preferred font for rendering this StringItem. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setText(java.lang.String text)
Sets the text contents of the StringItem. |
void |
setText(java.lang.String text,
Style style)
Sets the text contents of the StringItem along with a style. |
void |
setTextColor(int color)
Sets the text color for contents of the StringItem. |
protected void |
showNotify()
Called by the system to notify the item that it is now at least partially visible, when it previously had been completely invisible. |
int |
stringWidth(java.lang.String str)
Calculates the width of the given text. |
java.lang.String |
toString()
Generates a String representation of this item. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String text
protected java.lang.String[] textLines
protected int textColor
protected javax.microedition.lcdui.Font font
protected BitMapFont bitMapFont
protected BitMapFontViewer bitMapFontViewer
protected boolean useSingleLine
protected boolean clipText
protected int xOffset
protected boolean animateTextWrap
protected int textWrapDirection
protected int textWrapSpeed
protected int textHorizontalAdjustment
protected int textVerticalAdjustment
protected TextEffect textEffect
| Constructor Detail |
|---|
public StringItem(java.lang.String label,
java.lang.String text)
StringItem object. Calling this
constructor is equivalent to calling
StringItem(label, text, Item.PLAIN, null);
label - the Item labeltext - the text contentsStringItem(String, String, int, Style)
public StringItem(java.lang.String label,
java.lang.String text,
Style style)
StringItem object. Calling this
constructor is equivalent to calling
StringItem(label, text, Item.PLAIN, style);
label - the Item labeltext - the text contentsstyle - the styleStringItem(String, String, int, Style)
public StringItem(java.lang.String label,
java.lang.String text,
int appearanceMode)
StringItem object with the given label,
textual content, and appearance mode.
Either label or text may be present or null.
The appearanceMode parameter
(see Appearance Modes)
is a hint to the platform of the application's intended use
for this StringItem. To provide hyperlink- or
button-like behavior,
the application should associate a default Command with this
StringItem and add an
ItemCommandListener to this
StringItem.
Here is an example showing the use of a
StringItem as a button:
StringItem strItem = new StringItem("Default: ", "Set", Item.BUTTON);
strItem.setDefaultCommand(
new Command("Set", Command.ITEM, 1);
// icl is ItemCommandListener
strItem.setItemCommandListener(icl);
label - the StringItem's label, or null if no labeltext - the StringItem's text contents, or null if the contents are initially emptyappearanceMode - the appearance mode of the StringItem, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTON
java.lang.IllegalArgumentException - if appearanceMode invalid
public StringItem(java.lang.String label,
java.lang.String text,
int appearanceMode,
Style style)
StringItem object with the given label,
textual content, and appearance mode.
Either label or text may be present or null.
The appearanceMode parameter
(see Appearance Modes)
is a hint to the platform of the application's intended use
for this StringItem. To provide hyperlink- or
button-like behavior,
the application should associate a default Command with this
StringItem and add an
ItemCommandListener to this
StringItem.
Here is an example showing the use of a
StringItem as a button:
StringItem strItem = new StringItem("Default: ", "Set", Item.BUTTON);
strItem.setDefaultCommand(
new Command("Set", Command.ITEM, 1);
// icl is ItemCommandListener
strItem.setItemCommandListener(icl);
label - the StringItem's label, or null if no labeltext - the StringItem's text contents, or null if the contents are initially emptyappearanceMode - the appearance mode of the StringItem, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTONstyle - the style for this item
java.lang.IllegalArgumentException - if appearanceMode invalid| Method Detail |
|---|
public void animate(long currentTime,
ClippingRegion repaintRegion)
Item
animate in class ItemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)protected void defocus(Style originalStyle)
Item
defocus in class ItemoriginalStyle - the original style which will be restored.protected void hideNotify()
Itempaint() calls will be made on this item
until after a showNotify() has been called again.
The default implementation of this method sets the isShown field to false and calls hideNotify on style elements.
hideNotify in class Itemprotected void showNotify()
Itempaint() calls after
showNotify() has been called.
The default implementation of this method sets the isShown field to true and calls showNotify on style elements.
showNotify in class Itempublic java.lang.String getText()
StringItem, or
null if the StringItem is
empty.
setText(java.lang.String)public void setText(java.lang.String text)
StringItem.
If text
is null,
the StringItem
is set to be empty.
text - the new contentgetText()
public void setText(java.lang.String text,
Style style)
StringItem along with a style.
If text is null,
the StringItem
is set to be empty.
text - the new contentstyle - the new style, is ignored when nullgetText()public void setTextColor(int color)
StringItem.
color - the new color for the contentpublic void setFont(javax.microedition.lcdui.Font font)
StringItem.
The font is a hint, and the implementation may disregard
the application's preferred font.
The font parameter must be a valid Font
object or null. If the font parameter is
null, the implementation must use its default font
to render the StringItem.
font - - the preferred font to use to render this StringItemgetFont()public javax.microedition.lcdui.Font getFont()
StringItem. The
value returned is the font that had been set by the application,
even if that value had been disregarded by the implementation.
If no font had been set by the application, or if the application
explicitly set the font to null, the value is the default
font chosen by the implementation.
setFont(javax.microedition.lcdui.Font)
public void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Item
paintContent in class Itemx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.public int stringWidth(java.lang.String str)
str - the text of which the width should be determined
public int getFontHeight()
protected void initContent(int firstLineWidth,
int lineWidth)
Item
initContent in class ItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeightpublic void setStyle(Style style)
Item
setStyle in class Itemstyle - the new style for this item.protected java.lang.String createCssSelector()
Item
createCssSelector in class Itempublic java.lang.String toString()
Item
toString in class Itempublic void releaseResources()
Item
releaseResources in class Item
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||