e806. 创建进程监听对话框
A common feature of a user interface is to show a progress dialog that visually displays the progress of a long-running task. The dialog automatically disappears when the task is done. The ProgressMonitor class is a convenient dialog that implements a progress dialog.
The progress monitor contains a message which describes the long-running task. The message does not change for the duration of the task. The progress monitor also allows for a note which is a description of the current subtask. For example, if the task is copying a set of files, the note could be the name of the current file being copied.
Note: A progress monitor should not be reused. The properties that control when the dialog should appear are set when the monitor is constructed and cannot be reset.
See also e801 创建一个JProgressBar组件.
// This message describes the task that is running
String message = "Description of Task"; // This string describes a subtask; set to null if not needed
String note = "subtask"; // Set the title of the dialog if desired
String title = "Task Title";
UIManager.put("ProgressMonitor.progressText", title); // Create a progress monitor dialog.
// The dialog will use the supplied component's frame as the parent.
int min = 0;
int max = 100;
ProgressMonitor pm = new ProgressMonitor(component, message, note, min, max);
As the task progresses, check to see if the task has been cancelled and if not, call setProgress() and supply its current state.
// Check if the dialog has been cancelled
boolean cancelled = pm.isCanceled(); if (cancelled) {
// Stop task
} else {
// Set new state
pm.setProgress(newValue); // Change the note if desired
pm.setNote("New Note");
}
| Related Examples |
e806. 创建进程监听对话框的更多相关文章
- e807. 设置进程监听对话框的延迟弹出
By default, the progress monitor delays for a short period before it is displayed. There are two pro ...
- linux系统实现多个进程监听同一个端口
通过 fork 创建子进程的方式可以实现父子进程监听相同的端口. 方法:在绑定端口号(bind函数)之后,监听端口号之前(listen函数),用fork()函数生成子进程,这样子进程就可以克隆父进程, ...
- 获取Windows下某进程监听的TCP/UDP端口
1.在Windows下用CMD netstat命令可以获得当前进程监听端口号的信息,如netstat -ano可以看到IP.port.状态和监听的PID. 那么可以执行CMD这个进程得到监听的端口号信 ...
- iptables 完成联网控制 (续) ,独立native进程监听。
上一篇:http://www.cnblogs.com/oscar1011/p/5243877.html 之前做的iptables 来进行的联网控制,一直耿耿于怀,想要知道系统里的netd等等是如何做到 ...
- Yii2.0 安装yii2-queue并在Linux启动守护进程监听消息
一.什么是yii2-queue? Yii2-queue是Yii2.0 PHP框架下一个消息队列拓展插件,支持基于DB, Redis, RabbitMQ, AMQP, Beanstalk 和 Gearm ...
- xcode UIButton创建、监听按钮点击、自定义按钮 、状态 、内边距
代码创建 //创建UIButton UIButton * btnType=[[UIButton alloc]init]; //设置UIControlStateNormal状态下的文字颜色 [btnTy ...
- oracle 10g 数据库与客户端冲突导致实例创建无监听问题
同事在oracle 10g上创建一个实例,快结束时弹出一个错误,提示监听失败之类.查看服务,并无生成监听服务.于是删除重来,一连试了好几次,都是如此. 这真是令人心烦意乱.提示里面有说到端口1521, ...
- oracle创建静态监听
[oracle@localhost admin]$ pwd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin [oracle@localhos ...
- mac oxs 上查看进程监听的端口号 lsof
sudo netstat -ltnp |grep xxx lsof -p 26917 | grep LISTEN https://mengkang.net/1090.html
随机推荐
- Vue.js使用-组件(下篇)
上一节,我们定义了组件的基本使用,下面我们看看组件其他的一些特性. 1.组件作用域 同时在Vue对象和组件中定义一个属性,显示结果是怎样的呢? <!DOCTYPE html> <ht ...
- 关于linux上cron服务的python封装工具
关于cron:定时任务服务,一般linux自带且已启动.(pgrep cron查看cron服务是否启动了.) 关于plan:一个通过python来定制cron服务的工具.其官网:http://plan ...
- HBase的Write Ahead Log (WAL) —— 整体架构、线程模型【转】
转自:http://www.cnblogs.com/ohuang/p/5807543.html 解决的问题 HBase的Write Ahead Log (WAL)提供了一种高并发.持久化的日志保存与回 ...
- Android开发(四)——Android中的颜色
Android开发中关于资源文件的存储操作.对于Android资源也是非常重要的,主要包括文本字符串(strings).颜色(colors).数组(arrays).动画(anim).布局(layout ...
- DLL封装Interface(接口)(D2007+win764位)
相关资料: http://blog.csdn.net/liangpei2008/article/details/5394911 结果注意: 1.函数的传参方向必须一至. DLL实例代码: ZJQInt ...
- C# 裁剪图片
/// <summary> /// 生成缩略图 /// </summary> /// <param name="originalImagePath"& ...
- phpmyadmin 各种技巧拿 webshell
site.com/phpMyAdminsite.com/sql D:\wamp\www 账号还有密码 root 密码第一种CREATE TABLE `mysql`.`darkmoon` (`darkm ...
- java基础篇---注解(Annotation)
一.概念 Annontation是Java5开始引入的新特征.中文名称一般叫注解.它提供了一种安全的类似注释的机制,用来将任何的信息或元数据(metadata)与程序元素(类.方法.成员变量等)进行关 ...
- visualstudio学习
https://docs.microsoft.com/zh-CN/visualstudio/ide/get-started-with-visual-studio
- MySQL——SQL Mode详解
简介 MySQL服务器能够工作在不同的SQL模式下,并能针对不同的客户端以不同的方式应用这些模式.这样,应用程序就能对服务器操作进行量身定制以满足自己的需求.这类模式定义了MySQL应支持的SQL语法 ...