本文整理汇总了Java中javax.microedition.lcdui.Alert.setTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java Alert.setTimeout方法的具体用法?Java Alert.setTimeout怎么用?Java Alert.setTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.lcdui.Alert
的用法示例。
在下文中一共展示了Alert.setTimeout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inquiryCompleted
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
public void inquiryCompleted(int complete) {
log("device discovery is completed with return code:" + complete);
log("" + devices.size() + " devices are discovered");
deviceReturnCode = complete;
if (devices.size() == 0) {
Alert alert = new Alert("Bluetooth", "No Bluetooth device found", null, AlertType.INFO);
alert.setTimeout(3000);
remotedeviceui.showui();
display.setCurrent(alert, remotedeviceui);
} else {
remotedeviceui.showui();
display.setCurrent(remotedeviceui);
}
}
示例2: showEaster
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
private void showEaster()
{
if (easter > 99) {
easter = 0;
try {
Image[] images = new Image[2];
images[0] = Image.createImage(IMG_TREASURE);
images[1] = Image.createImage(IMG_TREASURE2);
Animation ac = new Animation(images, getDisplay());
Alert alert = new Alert(" You found a treasure!", null, null,
AlertType.ALARM);
alert.setTimeout(5000);
display.setCurrent(alert, ac);
ac.addCommand(homeCommand);
ac.setCommandListener(this);
ac.startAnimation();
} catch (IOException e) {
throw new JSimpleDiceException(EXCEPTION_MSG + e.getMessage());
}
}
}
示例3: showFatalErrorAndQuit
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
public void showFatalErrorAndQuit() {
Alert alert = new Alert("Fatal Error!", Log.getLogContent(), null, AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(alert);
alert.setCommandListener(new CommandListener() {
public void commandAction(javax.microedition.lcdui.Command command, Displayable displayable) {
synchronized (this){
this.notify();
}
}
});
try {
synchronized (this){
this.wait();
}
} catch (InterruptedException e) {
}
this.destroyApp(true);
}
示例4: test
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
public void test(TestHarness th) {
Alert alert = new Alert("Hello World", "Some text", null, AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
TextEditor textEditor = TextEditor.createTextEditor("Hello, world!", 20, 0, 100, 24);
textEditor.setParent(this);
th.setScreenAndWait(this);
textEditor.setFocus(true);
th.check(textEditor.hasFocus(), "TextEditor gained focus");
th.check(isTextEditorReallyFocused(), "TextEditor really gained focus");
th.setScreenAndWait(alert);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
th.fail("Unexpected exception: " + e);
}
th.check(textEditor.hasFocus(), "TextEditor kept focus");
th.check(!isTextEditorReallyFocused(), "TextEditor really lost focus");
th.setScreenAndWait(this);
th.check(textEditor.hasFocus(), "TextEditor maintained focus");
th.check(isTextEditorReallyFocused(), "TextEditor really regained focus");
th.setScreenAndWait(alert);
th.check(textEditor.hasFocus(), "TextEditor still has focus");
th.check(!isTextEditorReallyFocused(), "TextEditor really lost focus");
}
示例5: startApp
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
protected void startApp() throws MIDletStateChangeException {
try {
System.out.println("FileConnection " + System.getProperty("microedition.io.file.FileConnection.version"));
this.list.setDir(null);
setCurrentDisplayable(this.list);
} catch (SecurityException e) {
Alert alert = new Alert("Error", "Unable to access the restricted API", null, AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
setCurrentDisplayable(alert);
}
}
示例6: showResultImage
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
private void showResultImage()
{
try {
img = Image.createImage("/img/" + result + ".png");
} catch (IOException e) {
throw new JSimpleDiceException(EXCEPTION_MSG + e.getMessage());
}
Alert alert = new Alert(String.valueOf(result), null, img,
AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert, form);
}
示例7: showError
import javax.microedition.lcdui.Alert; //导入方法依赖的package包/类
private void showError(String message) {
Alert alert = new Alert("Error", message, null, AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
FCViewMIDlet.setCurrentDisplayable(alert);
}