Java Reference
In-Depth Information
deleteAll : Deletes all Item s in the Form
get : Takes an index and returns the Item at that index
insert : Takes an index and an Item and inserts the Item after the specified index
set : Takes an index and an Item and replaces the Item at the specified index with
the new Item
size : Returns the number of Items in the Form
A Form can have a listener that its Item s invoke when they change values. This notifi-
cation occurs by invoking the itemStateChanged method of the listener you register with
the setItemSateListener method. Note that this isn't triggered when you invoke Command
instances on the form; the CommandListener you register using the setCommandListener
receives Command events.
Alerting the User
The Alert class provides a screen that shows data to the user and waits for a predeter-
mined amount of time before automatically showing another Displayable . Typically,
Alert s appear full-screen; the application provides a title, optional image, and body text.
You can provide your own image, title, body text, and a gauge that replaces the image;
Figure 5-9 shows a sample Alert with a Gauge .
The constructor for an Alert can take up to four arguments: a title, text for the alert,
an image, and an alert type. The first three are self-explanatory; the fourth is a value from
the AlertType enumeration indicating whether the Alert is an alarm, confirmation, error,
warning, or informative alert. Once you create an Alert , you should configure it with its
time-out; as shown in Listing 5-3, you do this using the setTimeout method, specifying the
delay in milliseconds.
 
Search WWH ::




Custom Search