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
随机推荐
- js中实现对checkbox选中和取消
可以使用 element.attr('checked','checked') 来进行选中.但是不能使用 element.attr('checked','false') 来取消选中. 必须通过以下方式: ...
- 【MySQL】MySQL表设计的常用数据类型
整数类型,tinyint.smallint.mediumint.int.bigint 如果需要保存整数(不含小数),可以选择tinyint.smallint.mediumint.int.bigint, ...
- Android 微信支付资料收集
老板要求支持微信支付,收集了些资料做后期参考 http://www.360doc.com/content/15/0214/10/7044580_448519997.shtml http://www.t ...
- 【Socket】linux高性能网络服务程序
1.mystery引入 1)高性能的网络服务程序分为单线程重复式网络服务.多进程网络服务 .多线程网络服务.线程池网络服务和IO多路复用网络服务等 2)单线程重复式是最基本的一种TCP服务模式,其实现 ...
- 前端js上传文件插件
1. plupload文件上传 2.ajaxfileupload文件上传
- python 使用pillow将图片转换为webp格式
1.webp格式 webp格式是谷歌开发的一种旨在加快图片加载速度的格式,将图片转为webp格式后,体积约为原来的2/3,这可以节省大量的服务器带宽,微信公众号文章里的图片就是这种格式的. 2.使用p ...
- 移动app传统测试流程优化
[本文出自天外归云的博客园] 概述 在传统的软件测试流程中,每一期需求从开发到上线都要经历从需求分析与评审.测试用例评审.开发.测试.发布的流程.其中测试包含了后台测试.前端web测试.客户端测试.后 ...
- 确保安全的HTTPS(使用混合加密的HTTPS,前端面试常问)第二篇
苹果已经确定,在iOS9中通信机制采用HTTPS了. 第一篇:http://www.cnblogs.com/ziyi--caolu/p/4742577.html 上一篇详细介绍了为什么要对HTTP进行 ...
- C#学习笔记(26)——委托计算器
说明(2017-11-20 15:14:18): 1. 委托一直稀里糊涂的,有人说简单,有人说难,艹你们! 2. 其实主要是因为,平时不用委托也能解决大部分问题,所以都没有特意去用,网上也没有什么很好 ...
- [转]mysql中的字符串的拼接
字符串的拼接 1,Mysql 在Java.C#等编程语言中字符串的拼接可以通过加号“+”来实现,比如:"1"+"3"."a"+"b ...