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. 创建进程监听对话框的更多相关文章

  1. e807. 设置进程监听对话框的延迟弹出

    By default, the progress monitor delays for a short period before it is displayed. There are two pro ...

  2. linux系统实现多个进程监听同一个端口

    通过 fork 创建子进程的方式可以实现父子进程监听相同的端口. 方法:在绑定端口号(bind函数)之后,监听端口号之前(listen函数),用fork()函数生成子进程,这样子进程就可以克隆父进程, ...

  3. 获取Windows下某进程监听的TCP/UDP端口

    1.在Windows下用CMD netstat命令可以获得当前进程监听端口号的信息,如netstat -ano可以看到IP.port.状态和监听的PID. 那么可以执行CMD这个进程得到监听的端口号信 ...

  4. iptables 完成联网控制 (续) ,独立native进程监听。

    上一篇:http://www.cnblogs.com/oscar1011/p/5243877.html 之前做的iptables 来进行的联网控制,一直耿耿于怀,想要知道系统里的netd等等是如何做到 ...

  5. Yii2.0 安装yii2-queue并在Linux启动守护进程监听消息

    一.什么是yii2-queue? Yii2-queue是Yii2.0 PHP框架下一个消息队列拓展插件,支持基于DB, Redis, RabbitMQ, AMQP, Beanstalk 和 Gearm ...

  6. xcode UIButton创建、监听按钮点击、自定义按钮 、状态 、内边距

    代码创建 //创建UIButton UIButton * btnType=[[UIButton alloc]init]; //设置UIControlStateNormal状态下的文字颜色 [btnTy ...

  7. oracle 10g 数据库与客户端冲突导致实例创建无监听问题

    同事在oracle 10g上创建一个实例,快结束时弹出一个错误,提示监听失败之类.查看服务,并无生成监听服务.于是删除重来,一连试了好几次,都是如此. 这真是令人心烦意乱.提示里面有说到端口1521, ...

  8. oracle创建静态监听

    [oracle@localhost admin]$ pwd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin [oracle@localhos ...

  9. mac oxs 上查看进程监听的端口号 lsof

    sudo netstat -ltnp |grep xxx lsof -p 26917 | grep LISTEN https://mengkang.net/1090.html

随机推荐

  1. 用NPOI创建Excel、合并单元格、设置单元格样式、边框的方法

    本篇文章小编为大家介绍,用NPOI创建Excel.合并单元格.设置单元格样式.边框的方法.需要的朋友参考下 今天在做项目中,遇到使用代码生成具有一定样式的Excel,找了很多资料,最后终于解决了,Ex ...

  2. docker使用示例

    本文使用docker容器运行wordpress博客,采用了三种方法来演示,docker的使用 自建wordpress容器 采用官方的wordpress容器 采用docker compose容器管理工具 ...

  3. Android 编程下通过 zipalign 对 APK 文件进行优化

    zipalign zipalign is an archive alignment tool that provides important optimization to Android appli ...

  4. mysql load本地文件失败,提示access denied

    mysql load本地文件失败,提示access denied 解决方式 直接谷歌到stackoverflow,解决方式如下 mysql -u myuser -p --local-infile so ...

  5. nexus maven私服搭建

    1.在服务器上安装jdk 2.下载 nexus-3.14.0-04-unix.tar.gz,并上传到服务器/opt目录 3.解压 tar -zxvf nexus-3.14.0-04-unix.tar. ...

  6. Android下基于SDL的位图渲染(一)

    环境准备 安装Android开发环境(java.android-sdk.android ndk.gcc). 我使用的ndk版本是r10b/r10d,在win10/ubutu 15.04编译 下载sdl ...

  7. 使用 libvirt创建和管理KVM虚拟机

      1. libvirt介绍    Libvirt是一个软件集合,便于使用者管理虚拟机和其他虚拟化功能,比如存储和网络接口管理等等.Libvirt概括起来包括一个API库.一个 daemon(libv ...

  8. 使用一层神经网络训练mnist数据集

    import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_dat ...

  9. 【Java】使用BigDecimal类进行精确小数计算

    在商业计算中(尤其是计算价格)需要使用BigDecimal类来进行精确小数计算,因为用其他类型计算(如double)得到的结果不是精确的! 写个测试类. import org.junit.Test; ...

  10. TCP/IP协议层

    除了少数外,OSI协议簇本身已经成为Internet历史早期的遗留产物.当前OSI协议对于网络技术的贡献看来主要是对学习网络的学生讲述模块化的协议簇时,可以引用它的参考模型进行说明等的有限用途. 下面 ...