Document 12643102

advertisement
List

 List is a screen contains a set of choices the user can
use any one of it.
 There are three types of List :
 IMPLICIT , EXCLUSIVE , MULTIPLE
we learned it in ChoiceGroup lecture
List

The constructor of List :
List(String title, int listType)
List(String title, int listType, String[]
stringElements, Image[] imageElements)
List

 Title : the caption appear over the box
 List type : type of list , and written as the form
List.TYPE where the TYPE is EXCLUSIVE,
IMPLICIT, MULTIPLE
 stringElements : array of options that may add to
List
 imageElements : array of icons we like to add it with
the options , and the choice will appear with icon
image
 If we don’t want any icon , the value of array will be
null
List Methods

 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 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.
 Parameters:

cmd - the command to be added
List Methods

 append
 int append(java.lang.String stringPart,

Image imagePart)
 Appends an element to the Choice. The added element
will be the last element of the Choice. The size of the
Choice grows by one.
 Parameters:

stringPart - the string part of the element to be added

imagePart - the image part of the element to be
added, or null if there is no image part
 Returns:

the assigned index of the element
List Methods

 setTicker
 public void setTicker(Ticker ticker)
 Sets a ticker for use with this 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.
List Methods

 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().
 Parameters:

ticker - the ticker object used on this screen
List Methods

 setTitle
 public void setTitle(java.lang.String s)
 Sets the title of the 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().
 Parameters:

s - the new title, or null for no title
List Methods

 getTitle
public java.lang.String getTitle()



Gets the title of the Displayable. Returns null if
there is no title.
Returns:
the title of the instance, or null if no title
List Methods

 getTicker
 public Ticker getTicker()

Gets the ticker used by this Displayable.


Returns:
ticker object used, or null if no ticker is present
List Methods

 Another methods :
 int getSelectedIndex()
 boolean isSelected(int elementNum)
Example :
List mainList;
mainList = new List("Main List",List.IMPLICIT);

Gauge

 Gauge is similar to progress bar or slider , the user
can increase or decrease the value
 The constructor of gauge is:
 Gauge(String label, boolean interactive, int
maxValue, int initialValue)
Gauge

 Label : the title appear over the gauge
 Interactive : indicate if the user can change the value
or not by set the value true or false
 maxValue : the maximum value the gauge reach it
and it begin from zero to that value
 initialValue : value that the gauge appear with it
and it must be between zero and maxvalue
Gauge Methods

 getMaxValue
 public int getMaxValue()
 Gets the maximum value of this Gauge object.
 If this gauge is interactive, the maximum value will be a
positive integer. If this gauge is non-interactive, the
maximum value will be a positive integer (indicating that
the gauge has definite range) or the special value
INDEFINITE (indicating that the gauge has indefinite
range).
 Returns:

the maximum value of the Gauge, or INDEFINITE
Gauge Methods

 getValue
 public int getValue()
 Gets the current value of this Gauge object.
 Returns:

current value of the Gauge
Gauge Methods

 isInteractive
 public boolean isInteractive()

Tells whether the user is allowed to change the value of
the Gauge.


Returns:
a boolean indicating whether the Gauge is interactive
Gauge Methods

setMaxValue

 public void setMaxValue (int maxValue)
 Sets the maximum value of this Gauge object.
 For interactive gauges, the new maximum value must be greater
than zero, otherwise an exception is thrown. For non-interactive
gauges, the new maximum value must be greater than zero or equal
to the special value INDEFINITE, otherwise an exception is thrown.
 If the new maximum value is greater than zero, this provides the
gauge with a definite range. If the gauge previously had a definite
range, and if the current value is greater than new maximum value,
the current value is set to be equal to the new maximum value. If
the gauge previously had a definite range, and if the current value
is less than or equal to the new maximum value, the current value is
left unchanged.
Gauge Methods

 If the new maximum value is greater than zero, and
if the gauge had previously had indefinite range,
this new maximum value provides it with a definite
range. Its graphical representation must change
accordingly,
the
previous
state
of
CONTINUOUS_IDLE,
INCREMENTAL_IDLE,
CONTINUOUS_RUNNING,
or
INCREMENTAL_UPDATING is ignored, and the
current value is set to zero.
Gauge Methods

 If this gauge is non-interactive and the new maximum
value is INDEFINITE, this gives the gauge indefinite
range. If the gauge previously had a definite range, its
graphical representation must change accordingly, the
previous value is ignored, and the current state is set to
CONTINUOUS_IDLE. If the gauge previously had an
indefinite range, setting the maximum value to
INDEFINITE will have no effect.


Parameters:
maxValue - the new maximum value
Gauge Methods

 getValue
 public int getValue()
 Gets the current value of this Gauge object.
 If this Gauge object is a non-interactive gauge with
indefinite range, the value returned will be one of
CONTINUOUS_IDLE,
INCREMENTAL_IDLE,
CONTINUOUS_RUNNING,
or
INCREMENTAL_UPDATING. Otherwise, it will be an
integer between zero and the gauge's maximum value,
inclusive.
 Returns:

current value of the Gauge
Example

Example :
Gauge gauge;
gauge = new Gauge("Progress", false, 10, 0);


Download