|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Screen
javax.microedition.lcdui.TextBox
de.enough.polish.midp.ui.TextBox
public class TextBox
Embeds a native javax.microedition.lcdui.TextBox
Copyright Enough Software 2008
| Constructor Summary | |
|---|---|
TextBox(String title,
String text,
int maxSize,
int constraints)
Creates a new TextBox object with the given title
string, initial
contents, maximum size in characters, and constraints. |
|
| Method Summary | |
|---|---|
void |
addCommand(Command cmd)
Adds a command to the Displayable. |
int |
getHeight()
Gets the height in pixels of the displayable area available to the application. |
Ticker |
getPolishTicker()
Gets the ticker used by this Displayable. |
int |
getWidth()
Gets the width in pixels of the displayable area available to the application. |
void |
removeCommand(Command cmd)
Removes a command from the Displayable. |
void |
setCommandListener(CommandListener l)
Sets a listener for Commands to this
Displayable,
replacing any previous CommandListener. |
void |
setTicker(Ticker ticker)
Sets a ticker for use with this Displayable,
replacing any
previous ticker. |
void |
sizeChanged(int w,
int h)
The implementation calls this method when the available area of the Displayable has been changed. |
| Methods inherited from class javax.microedition.lcdui.TextBox |
|---|
delete, getCaretPosition, getChars, getConstraints, getMaxSize, getString, insert, insert, setChars, setConstraints, setInitialInputMode, setMaxSize, setString, setTicker, setTitle, size |
| Methods inherited from class javax.microedition.lcdui.Displayable |
|---|
addCommand, getTicker, getTitle, isShown, removeCommand, setCommandListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.enough.polish.ui.Displayable |
|---|
getTitle, isShown, setTitle |
| Constructor Detail |
|---|
public TextBox(String title,
String text,
int maxSize,
int constraints)
TextBox object with the given title
string, initial
contents, maximum size in characters, and constraints.
If the text parameter is null, the
TextBox is created empty.
The maxSize parameter must be greater than zero.
An IllegalArgumentException is thrown if the
length of the initial contents string exceeds maxSize.
However,
the implementation may assign a maximum size smaller than the
application had requested. If this occurs, and if the length of the
contents exceeds the newly assigned maximum size, the contents are
truncated from the end in order to fit, and no exception is thrown.
title - the title text to be shown with the displaytext - the initial contents of the text editing area, null may be used to indicate no initial contentmaxSize - the maximum capacity in characters. The implementation may limit boundary maximum capacity and the actually assigned capacity may me smaller than requested. A defensive application will test the actually given capacity with getMaxSize().constraints - see input constraints
IllegalArgumentException - if maxSize is zero or less
or if the constraints parameter is invalid
or if text is illegal for the specified constraints
or if the length of the string exceeds the requested maximum capacity| Method Detail |
|---|
public void addCommand(Command cmd)
DisplayableDisplayable. The
implementation may choose,
for example,
to add the command to any of the available soft buttons or place it
in a menu.
If the added command is already in the screen (tested by comparing the
object references), the method has no effect.
If the Displayable is actually visible on the
display, and this call
affects the set of visible commands, the implementation should update
the display as soon as it is feasible to do so.
addCommand in interface Displayablecmd - the command to be addedpublic void removeCommand(Command cmd)
DisplayableDisplayable.
If the command is not in the Displayable
(tested by comparing the
object references), the method has no effect.
If the Displayable is actually visible on the
display, and this call
affects the set of visible commands, the implementation should update
the display as soon as it is feasible to do so.
If cmd is null, this method
does nothing.
removeCommand in interface Displayablecmd - the command to be removedpublic void setCommandListener(CommandListener l)
DisplayableCommands to this
Displayable,
replacing any previous CommandListener. A
null reference is
allowed and has the effect of removing any existing listener.
setCommandListener in interface Displayablel - the new listener, or null.public Ticker getPolishTicker()
DisplayableDisplayable.
getPolishTicker in interface DisplayableDisplayable.setTicker(Ticker)public void setTicker(Ticker ticker)
DisplayableDisplayable,
replacing any
previous ticker.
If null, removes the ticker object
from this Displayable. The same ticker may be shared by
several Displayable
objects within an application. This is done by calling
setTicker()
with the same Ticker object on several
different Displayable objects.
If the Displayable is actually visible on the display,
the implementation should update
the display as soon as it is feasible to do so.
The existence of a ticker may affect the size
of the area available for Displayable's contents.
Addition, removal, or the setting of the ticker at runtime
may dynamically change the size of the content area.
This is most important to be aware of when using the
Canvas class.
If the available area does change, the application will be notified
via a call to sizeChanged().
setTicker in interface Displayableticker - - the ticker object used on this screenDisplayable.getPolishTicker()
public void sizeChanged(int w,
int h)
DisplayableDisplayable has been changed.
The "available area" is the area of the display that
may be occupied by
the application's contents, such as Items in a
Form or graphics within
a Canvas. It does not include space occupied
by a title, a ticker,
command labels, scroll bars, system status area, etc. A size change
can occur as a result of the addition, removal, or changed contents of
any of these display features.
This method is called at least once before the
Displayable is shown for the first time.
If the size of a Displayable changes while
it is visible,
sizeChanged will be called. If the size of a
Displayable
changes while it is not visible, calls to
sizeChanged may be deferred. If the size had changed
while the Displayable was not visible,
sizeChanged will be
called at least once at the time the
Displayable becomes visible once
again.
The default implementation of this method in Displayable
and its
subclasses defined in this specification must be empty.
This method is intended solely for being overridden by the
application. This method is defined on Displayable
even though applications are prohibited from creating
direct subclasses of Displayable.
It is defined here so that applications can override it in
subclasses of Canvas and Form.
This is useful for Canvas subclasses to tailor
their graphics and for Forms to modify
Item sizes and layout
directives in order to fit their contents within the the available
display area.
sizeChanged in interface DisplayablesizeChanged in class Displayablew - - the new width in pixels of the available areah - - the new height in pixels of the available areapublic int getHeight()
DisplayableDisplayable subclass. This value may depend
on how the device uses the
display and may be affected by the presence of a title, a ticker, or
commands.
This method returns the proper result at all times, even if the
Displayable object has not yet been shown.
getHeight in interface DisplayablegetHeight in class Displayablepublic int getWidth()
DisplayableDisplayable subclass. This value may depend
on how the device uses the
display and may be affected by the presence of a title, a ticker, or
commands.
This method returns the proper result at all times, even if the
Displayable object has not yet been shown.
getWidth in interface DisplayablegetWidth in class Displayable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||