Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

MID Profile

javax.microedition.lcdui
Class Displayable

java.lang.Object
  |
  +--javax.microedition.lcdui.Displayable
Direct Known Subclasses:
Canvas, Screen

public abstract class Displayable
extends Object

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.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isShown

public boolean isShown()
Checks if the Displayable is actually visible on the 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.
Returns:
true if the Displayable is currently visible

addCommand

public void addCommand(Command cmd)
Adds a command to the Displayable. The implementation may choose, for example, to add the command to any of the available softbuttons 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.
Parameters:
cmd - the command to be added
Throws:
NullPointerException - if cmd is null

removeCommand

public void removeCommand(Command cmd)
Removes a command from the Displayable. 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.
Parameters:
cmd - the command to be removed

setCommandListener

public void setCommandListener(CommandListener l)
Sets a listener for Commands to this Displayable, replacing any previous CommandListener. A null reference is allowed and has the effect of removing any existing listener.
Parameters:
l - the new listener, or null.

MID Profile

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 37 specification.