} catch (IOException e) {
Alert alert = new Alert("地图; IOException", "网络连接捕获住异常:" + e.toString() + "\n\n" + "程序在10秒后会自动退出", null, AlertType.WARNING);
final Command exitCommand = new Command("退出", Command.EXIT, 1);
alert.addCommand(exitCommand);
alert.setTimeout(10 * 1000);
alert.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if (exitCommand == c) {
dispatcher.exit(true);
}
}
});
dispatcher.display.setCurrent(alert);
}
这一段代码如果没有alert.setTimeout(10*1000)这条语句,不经点击exitCommand按钮,程序会自动执行dispatcher.exit(true); 纠结了一个上午,解释如下:
When it is created, an Alert implicitly has the special Command DISMISS_COMMAND present on it. If the application adds any other Commands to the Alert, DISMISS_COMMAND is implicitly removed. If the application removes all other Commands, DISMISS_COMMAND is implicitly restored. Attempts to add or remove DISMISS_COMMAND explicitly are ignored. Thus, there is always at least one Command present on an Alert.
If there are two or more Commands present on the Alert, it is automatically turned into a modal Alert, and the timeout value is always FOREVER. The Alert remains on the display until a Command is invoked. If the Alert has one Command (whether it is DISMISS_COMMAND or it is one provided by the application), the Alert may have the timed behavior as described above. When a timeout occurs, the effect is the same as if the user had invoked the Command explicitly.
分享到:
相关推荐
Command & Conquer(tm) Red Alert(tm) 3 Worldbuilder
自己改写的js弹出div层模拟alert 可以自定义样式 在iframe框架中使用 避免了覆盖层只覆盖子页面的问题
因为系统alert在苹果手机微信中,提示时,顶部会显示网站地址。 同时其他后续操作需要在js中继续填写。因此简单用div写了一个alert提示框,并自动关闭。 效果图 css样式 /*弹出消息对话框样式*/ .show_alert_box{...
jsp页面 完整的功能 只要将jsp嵌入项目 即可使用 原生代码 不含任何JS框架函数 兼容性不错 好东东 大家一起分享 重写了alert 添加了 渐变屏蔽层 重写了样式
Alert消息框中设置icon图标的例子
NULL 博文链接:https://jsufly.iteye.com/blog/804271
ALERT
Alert组件的应用,具体操作Alert组件应用的实例flash源文件
alert弹出框去掉地址信息!是页面设计更完美!
对于alert 进行自定义 , 有两个按钮和自定义图片
alertmanager tar.gz包包含alertmanager alertmanager.yml amtool data LICENSE NOTICE
jquery中alert实现源代码。提供了jquery.alerts.css和 jquery.alerts.js两个文件,在jquery-1.6.2.js下面测试通过。
sweetalert.css
js jquery alert样式
重写window.alert方法 重写window.alert方法
jQueryAlert:jQuery JS的Alert、Comfirm、Prompt的提示对话框效果,效果非常棒,可以用来模拟代替默认的对话框
ORACLE ALERT日志备份shell.自动获取alert日志路径。实现按月分类 加上crontab,可以实现每天备份
JQuery Alert Confirm
其中,ios6alert.js是插件主要部分的js,ios6alert.css中定义的是对话框的默认样式,可以根据需要进行编辑。 对话框的HTML结构是通过js动态添加到页面上的,所以不需要在页面上额外准备内容。 只需要运行$("body")....
js 精美弹出框 alert 可以设置样式,取代传统丑陋的alert弹出框