fds.micro.ui
Class StringItem

java.lang.Object
  extended byfds.micro.ui.Component
      extended byfds.micro.ui.StringItem

public class StringItem
extends Component

This class implements an component that display a non interactive string.
An object of this class is dedicated to be used within an object of fds.micro.ui.AbstractPanel sub-class (J2ME).

Warning: Use this class only if you want to have control on rendering. If possible, always prefer javax.microedition.lcdui.StringItem.

You can read below a typical use within a class that inherit fds.micro.ui.RowPanel:

 ...
 this.append(new StringItem("This is a decorative string."));
 ...

Author:
Frédéric DE STEUR

Field Summary
 
Fields inherited from class fds.micro.ui.Component
INTERN_BOTTOM_VALIGN, INTERN_CENTER_HALIGN, INTERN_CENTER_VALIGN, INTERN_LEFT_HALIGN, INTERN_RIGHT_HALIGN, INTERN_TOP_VALIGN
 
Constructor Summary
StringItem()
          Build a string that displays a single space character.
StringItem(java.lang.String text)
          Build an component that displays the given string.
 
Method Summary
 javax.microedition.lcdui.Font getFont()
          Get the font used to display the string.
 java.lang.String getText()
          Get the displayed text.
 void keyPressed(int keyCode, int gameAction)
          Called to notify the component that a key is pressed.
 void pointerPressed(int xpos, int ypos)
          Called to notify the component that pointer device was pressed.
 void setFont(javax.microedition.lcdui.Font font)
          Change the font used to display the string.
 void setForeground(int redFore, int greenFore, int blueFore)
          Set the foreground color used to display the text.
 void setMaximumSize(int width, int height)
          Set the maximum size for this component.
 void setText(java.lang.String text)
          Change the text to display.
 
Methods inherited from class fds.micro.ui.Component
addFocusListener, addItemListener, equals, getHAlign, getHeight, getParent, getVAlign, getWidth, getX, getY, isDisabled, isHaveFocus, isHidden, isManageFocus, isOpaque, removeFocusListener, removeItemListener, setBackground, setDisabled, setFocusColor, setHAlign, setHidden, setLocation, setManageFocus, setOpaque, setVAlign
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringItem

public StringItem()
Build a string that displays a single space character.


StringItem

public StringItem(java.lang.String text)
Build an component that displays the given string.

Parameters:
text - The text to display.
Method Detail

getFont

public javax.microedition.lcdui.Font getFont()
Get the font used to display the string.

Returns:
Returns the string font.

getText

public java.lang.String getText()
Get the displayed text.

Returns:
Returns the text.

keyPressed

public void keyPressed(int keyCode,
                       int gameAction)
Called to notify the component that a key is pressed.

Specified by:
keyPressed in class Component
Parameters:
keyCode - The key code.
gameAction - Game action corresponding to the key code.

pointerPressed

public void pointerPressed(int xpos,
                           int ypos)
Called to notify the component that pointer device was pressed.

Specified by:
pointerPressed in class Component
Parameters:
xpos - The X position of pointer on parent Canvas.
ypos - The Y position of pointer on parent Canvas.

setFont

public void setFont(javax.microedition.lcdui.Font font)
Change the font used to display the string.

Parameters:
font - The new font to use.

setForeground

public void setForeground(int redFore,
                          int greenFore,
                          int blueFore)
Set the foreground color used to display the text.

Parameters:
redFore - The red component of the color.
greenFore - The green component of the color.
blueFore - The blue component of the color.

setMaximumSize

public void setMaximumSize(int width,
                           int height)
Set the maximum size for this component.

Overrides:
setMaximumSize in class Component
Parameters:
width - The maximum width.
height - The maximum height.

setText

public void setText(java.lang.String text)
Change the text to display.

Parameters:
text - The text to display.