Разработка мобильных приложений. Соколова В.В. - 86 стр.

UptoLike

Составители: 

86
import javax.microedition.lcdui.Ticker;
import javax.microedition.midlet.*;
public class TextBoxExample extends MIDlet {
// Maximum text size in the TextBox
private static final int MAX_TEXT_SIZE = 120;
public void startApp() {
// Create the TextBox
TextBox textBox = new TextBox("TextBox Example",
"Initial TextBox text",
MAX_TEXT_SIZE, TextField.ANY);
// Create a ticker
Ticker ticker = new Ticker("Ticker for the Text-
Box");
textBox.setTicker(ticker);
// Create Exit Command
Command exitCommand = new Command("Exit", Com-
mand.EXIT, 0);
textBox.addCommand(exitCommand);
textBox.setCommandListener(new CommandListener(){
public void commandAction(Command c, Displayable
d) {
notifyDestroyed();
}
});
// Make the TextBox to be visible on the display
Display.getDisplay(this).setCurrent(textBox);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
Alert
Элемент alert представляет собой экран, содержащий уведомле-
ние для пользователя.
В MIDP существует два типа уведомлений:
1) timed alert уведомление находится на экране определенное
время и затем исчезает;
2) modal alert уведомление демонстрируется пользователю до
тех пор, пока он его не закроет.
Для создания алертов используются следующие конструкторы:
public Alert(String title);
public Alert(String title, String alertText, Im-
age alertImage, AlertType alertType);