Other Interfaces (Cont.)
final Alert soundAlert = new Alert( "sound Alert" );
- The class javax.microedition.lcdui.Alert is a screen that shows data to the user and waits for a certain period of time before proceeding to the next screen.
An alert is an ordinary screen that can contain text (
String
) and image, and which handles events like other screens.
The intended use of Alert
is to inform the user about errors and other exceptional conditions.
- The constructor public Alert(String title) constructs a new, empty
Alert
object with the given title.
soundAlert.setType( AlertType.ERROR );
The method public void setType(AlertType type) sets the type of the Alert
.
The handling and behavior of specific AlertTypes
is described in AlertType.
An ERROR AlertType
is a hint to alert the user to an erroneous operation.
soundAlert.setString( "** ERROR **" );
The method public void setString(String str) sets the text string used in the Alert
.
java.util.Date now = new java.util.Date( );
- The class java.util.Date represents a specific instant in time, with millisecond precision.
- The constructor public Date( ) allocates a
Date
object and initializes it to represent the current time specified number of milliseconds since the standard base time known as “the epoch,” namely January 1, 1970, 00:00:00 GMT.
date.setDate( now );
The method public void javax.microedition.lcdui.DateField.setDate(Date date) sets a new value for this field.