Blackberry JAVA DEVELOPMENT ENVIRONMENT Manuale introduttivo - Pagina 23
Sfoglia online o scarica il pdf Manuale introduttivo per Software Blackberry JAVA DEVELOPMENT ENVIRONMENT. Blackberry JAVA DEVELOPMENT ENVIRONMENT 32. Version 4.7.0
Anche per Blackberry JAVA DEVELOPMENT ENVIRONMENT: Nota di rilascio (8 pagine)
//Los Angeles, Chicago, or New York.
String choices[] = {"Los Angeles", "Chicago", "New York"};
choiceField = new ObjectChoiceField("Select a City", choices);
add(choiceField);
}
//To display a dialog box when a BlackBerry smartphone user
//closes the BlackBerry device application, override the onClose() method.
public boolean onClose()
{
Dialog.alert("Goodbye!");
System.exit(0);
return true;
}
//Create a menu item for BlackBerry smartphone users to click to see more
information about the city they select.
private MenuItem _viewItem = new MenuItem("More Info", 110, 10) {
public void run() {
UiApplication.getUiApplication.pushScreen(_infoScreen);
}
};
//Create a menu item for BlackBerry smartphone users to click to close the
BlackBerry device application.
private MenuItem _closeItem = new MenuItem("Close", 200000, 10) {
public void run()
{
}
};
//To add menu items to the menu of the BlackBerry device application, override the
makeMenu method.
protected void makeMenu( Menu menu, int instance )
{
menu.add(_viewItem);
menu.add(_closeItem);
}
//Create an inner class for a new screen that displays
//information about the city a BlackBerry smartphone user selects.
private class InfoScreen extends MainScreen
{
public InfoScreen() {
2: Create a BlackBerry device application with advanced UI features
//Store the index of the city the BlackBerry device user selects
select = choiceField.getSelectedIndex();
//Display a new screen with information about the
//city the BlackBerry smartphone user selects
_infoScreen = new InfoScreen();
onClose();
super();
//Add fields to display a screen label that identifies the city
//as well as information on population, state, and attractions.
23