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
随机推荐
- .NET MVC5+ EF+AutoFac自动注入框架
1.创建一个MVC系统 VIEW显示页面代码: <link href="~/Content/bootstrap.css" rel="stylesheet" ...
- linux命令(41):文件和文件夹的颜色
各个颜色的文件分别代表的是:蓝色表示目录:绿色表示可执行文件:红色表示压缩文件:浅蓝色表示链接文件:灰色表示其它文件:红色闪烁表示链接的文件有问题了:黄色是设备文件,包括block, char, fi ...
- linux命令(35):diff命令
diff 命令是 linux上非常重要的工具,用于比较文件的内容,特别是比较两个版本不同的文件以找到改动的地方.diff在命令行中打印每一个行的改动.最新版本的diff还支持二进制文件.diff程序的 ...
- Animation.setFillAfter and Animation.setFillBefore的作用
转:http://blog.csdn.net/yangweigbh/article/details/9788531 setFillAfter(boolean fillAfter) 在Android ...
- C#学习笔记(7)——委托
说明(2017-5-29 22:22:50): 1. 语法:public delegate void mydel();这一句在类外面,命名空间里面. 2. 专门新建一个方法,参数是委托: public ...
- Eigen教程(6)
整理下Eigen库的教程,参考:http://eigen.tuxfamily.org/dox/index.html 高级初始化方法 本篇介绍几种高级的矩阵初始化方法,重点介绍逗号初始化和特殊矩阵(单位 ...
- Android NFC近场通信1——NFC概述
最近对NFC挺感兴趣,而且新换的手机也支持NFC功能(最近换了Find5,感觉还不错O(∩_∩)O),所以打算学学NFC编程.NFC就是我们经常说的近场通信.通常距离是4厘米或更短.NFC工作频率是1 ...
- Spring高级装配(一) profile
Spring高级装配要学习的内容包括: Spring profile 条件化的bean声明 自动装配与歧义性 bean的作用域 Spring表达式语言 以上属于高级一点的bean装配技术,如果你没有啥 ...
- git diff 的用法
git diff 对比两个文件修改的记录 不带参数的调用 git diff filename 这种是比较 工作区和暂存区 比较暂存区与最新本地版本库 git diff --cached filenam ...
- mac使用nvm安装node进行多版本管理
安装 $ git clone https://github.com/creationix/nvm.git ~/.nvm $ source ~/.nvm/nvm.sh vi ~/.bash_profil ...