|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.lcdui.Displayable
An object that has the capability of being placed on the display. A Displayable object may have commands and listeners associated with it. The contents displayed and their interaction with the user are defined by subclasses.
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 |
getTicker()
Gets the ticker used by this Displayable . |
String |
getTitle()
Gets the title of the Displayable . |
int |
getWidth()
Gets the width in pixels of the displayable area available to the application. |
boolean |
isShown()
Checks if the Displayable is actually visible on the Display . |
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 |
setTitle(String s)
Sets the title of the Displayable . |
protected 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 java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void addCommand(Command cmd)
cmd
- the Command to be added.
NullPointerException
- if cmd is nullCommand
public boolean isShown()
Display
. In order
for a Displayable to be visible, all of the following must be true: the
Display's MIDlet must be running in the foreground, the Displayable must
be the Display's current screen, and the Displayable must not be obscured
by a system screen.
public void removeCommand(Command cmd)
cmd
- the Command to be removed.Command
public void setCommandListener(CommandListener l)
Commands
to this Displayable,
replacing any previous CommandListener. A null
reference is allowed and has the effect of removing any existing
listener.
l
- the new listener, or null
.public Ticker getTicker()
Displayable
.
null
if no
ticker is presentsetTicker(javax.microedition.lcdui.Ticker)
public void setTicker(Ticker ticker)
Displayable
,
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()
.
ticker
- the ticker object used on this screengetTicker()
public void setTitle(String s)
Displayable
. If
null
is given,
removes the title.
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 title may affect the size
of the area available for Displayable
content.
Addition, removal, or the setting of the title text 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()
.
s
- the new title, or null
for no titlegetTitle()
protected void sizeChanged(int w, int h)
Displayable
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.
w
- the new width in pixels of the available areah
- the new height in pixels of the available areapublic String getTitle()
Displayable
. Returns
null
if there is no title.
null
if no titlesetTitle(java.lang.String)
public int getHeight()
Displayable
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.
public int getWidth()
Displayable
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |