本文整理汇总了Java中javax.microedition.lcdui.AlertType类的典型用法代码示例。如果您正苦于以下问题:Java AlertType类的具体用法?Java AlertType怎么用?Java AlertType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AlertType类属于javax.microedition.lcdui包,在下文中一共展示了AlertType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playBuiltinSound
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* @inheritDoc
*/
public void playBuiltinSound(String soundIdentifier) {
if(!playUserSound(soundIdentifier)) {
if(soundIdentifier.equals(Display.SOUND_TYPE_ALARM)) {
AlertType.ALARM.playSound(display);
return;
}
if(soundIdentifier.equals(Display.SOUND_TYPE_CONFIRMATION)) {
AlertType.CONFIRMATION.playSound(display);
return;
}
if(soundIdentifier.equals(Display.SOUND_TYPE_ERROR)) {
AlertType.ERROR.playSound(display);
return;
}
if(soundIdentifier.equals(Display.SOUND_TYPE_INFO)) {
AlertType.INFO.playSound(display);
return;
}
if(soundIdentifier.equals(Display.SOUND_TYPE_WARNING)) {
AlertType.WARNING.playSound(display);
return;
}
}
}
示例2: cacheURL
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
protected void cacheURL(TransportMessage message) {
try{
String destinationUrl = ((BTTransportDestination)message.getDestination()).getURL();
//destinationUrl="btspp://00037ABEFE97:1";
Vector existingURLs = JavaRosaServiceProvider.instance().getPropertyManager().getProperty(BTTransportProperties.POST_URL_LIST_PROPERTY);
if(existingURLs!=null){
if (!existingURLs.contains(destinationUrl)) {
existingURLs.addElement(destinationUrl);
JavaRosaServiceProvider.instance().getPropertyManager().setProperty(BTTransportProperties.POST_URL_LIST_PROPERTY,existingURLs);
}
}else{
//add code to add urls outside the HttpTransportProperties
}
}//End try
catch(Exception e){
AlertEngine alertEngine = new AlertEngine("ERROR! ioe", e.getMessage()+" cacheURL()", null, AlertType.ERROR);
JavaRosaServiceProvider.instance().showView(alertEngine);
}// end catch
}
示例3: showSuspendAlert
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* Shows alert notifying user of system suspend.
* @param token security token for accessing restricted API
*/
static synchronized void showSuspendAlert(final SecurityToken token) {
if (null == suspendAlert && AlertTimer.shouldShow()) {
String title = Resource.getString(
ResourceConstants.SR_SUSPEND_ALERT_TITLE, null);
String message = Resource.getString(
ResourceConstants.SR_SUSPEND_ALERT_MSG, null);
AlertTimer.start();
CommandListener ignoring = new CommandListener() {
public void commandAction(Command c, Displayable d) {}
};
suspendAlert = new SystemAlert(getDisp(token), title,
message, null, AlertType.WARNING);
suspendAlert.setCommandListener(ignoring);
suspendAlert.runInNewThread();
}
}
示例4: showLoginRequiredMessage
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* Show a login required message on the screen.
*
* @param title
* @param alertText
* @param type
*/
public final void showLoginRequiredMessage() {
Alert alert = new Alert(LOGIN_REQUIRED_LABEL, LOGIN_REQUIRED_TEXT,
null, AlertType.INFO);
alert.addCommand(new Command(LOGIN_REQUIRED_YES, Command.OK, 0));
alert.addCommand(new Command(LOGIN_REQUIRED_NO, Command.CANCEL, 0));
alert.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if(c.getCommandType() == Command.OK) {
showLoginView();
} else {
setDisplay(self);
}
}
});
setDisplay(alert);
}
示例5: loginFailed
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* Handle and signal a failed login.
*/
public void loginFailed(String reason) {
// Show an error message and refresh the view
final String message =
"Login failed" +
(reason != null ? " (" + reason + ")" : "") +
". Please try again.";
Main.getInstance().showAlertMessage(
"Login failed",
message,
AlertType.INFO
);
show();
loginListener.loginFailed(reason);
}
示例6: commandAction
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
public void commandAction(Command cmd, Displayable disp) {
//#debug info
System.out.println("commandAction with cmd=" + cmd.getLabel() + ", screen=" + disp );
if (cmd == this.backCommand) {
display.setCurrent(mainScreen);
} else if (cmd == this.exitCommand) {
//#debug info
System.out.println("Exit application");
this.notifyDestroyed();
} else if (cmd == this.aboutCommand) {
String param = this.getAppProperty("Xfolite-Version");
Alert alert = new Alert(
Locale.get("main.label.about"),
Locale.get("main.msg.about", param),
null,
AlertType.INFO);
// Looks like an error but builds
this.display.setCurrent(alert, mainScreen);
}
}
示例7: inquiryCompleted
import javax.microedition.lcdui.AlertType; //导入依赖的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);
}
}
示例8: showEaster
import javax.microedition.lcdui.AlertType; //导入依赖的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());
}
}
}
示例9: showFatalErrorAndQuit
import javax.microedition.lcdui.AlertType; //导入依赖的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);
}
示例10: cleanUp
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
private void cleanUp(DataInputStream in) {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
AlertEngine alertEngine = new AlertEngine("ERROR! Clean up", e.getMessage(), null, AlertType.ERROR);
JavaRosaServiceProvider.instance().showView(alertEngine);
}
}
}
示例11: getDefaultDestination
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
public ITransportDestination getDefaultDestination() {
String url = JavaRosaServiceProvider.instance().getPropertyManager().getSingularProperty(BTTransportProperties.POST_URL_PROPERTY);
if(url == null) {
return null;
} else {
//url = "btspp://00037ABEFE97:1";
String showURL = "Now using "+url;
AlertEngine alertEngine = new AlertEngine("ERROR! ioe", showURL, null, AlertType.ERROR);
JavaRosaServiceProvider.instance().showView(alertEngine);
return new BTTransportDestination(url);
}
}
示例12: showAllKilledAlert
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* Shows alert notifying user that all MIDlets were killed during
* preceding system suspension.
* @param token security token for accessing restricted API
*/
static void showAllKilledAlert(SecurityToken token) {
String title = Resource.getString(
ResourceConstants.SR_ALL_KILLED_ALERT_TITLE, null);
String message = Resource.getString(
ResourceConstants.SR_ALL_KILLED_ALERT_MSG, null);
SystemAlert alert = new SystemAlert(getDisp(token), title,
message, null, AlertType.WARNING);
alert.runInNewThread();
}
示例13: displayException
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
/**
* Display an exception to the user.
*
* @param securityToken security token for displaying System Alert.
* @param exceptionMsg exception message
*/
static void displayException(SecurityToken securityToken,
String exceptionMsg) {
SystemAlert alert = new SystemAlert(securityToken, "Exception",
exceptionMsg, null,
AlertType.ERROR);
alert.run();
alert.waitForUser();
}
示例14: commentingFailed
import javax.microedition.lcdui.AlertType; //导入依赖的package包/类
public void commentingFailed(String thingName, String text) {
Main.getInstance().showAlertMessage(
"Not sent",
"The comment could not be sent. Please try again.",
AlertType.INFO
);
}
示例15: test
import javax.microedition.lcdui.AlertType; //导入依赖的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");
}