Shell 窗体进度条
来源:互联网 发布:mac硬盘取消密码 编辑:程序博客网 时间:2024/05/16 09:39
import java.lang.reflect.InvocationTargetException;import org.eclipse.core.runtime.IProgressMonitor;import org.eclipse.jface.dialogs.ProgressMonitorDialog;import org.eclipse.jface.operation.IRunnableWithProgress;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Shell;// 循环多次public class TestProgress { static boolean stopflg = false; /** * Launch the application * @param args */ public static void main(String[] args) throws Exception{ final Display display = Display.getDefault(); final Shell shell = new Shell(); shell.setSize(500, 375); shell.setText("SWT Application"); // IRunnableWithProgress runnable = new IRunnableWithProgress(){ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("generate", 30); int i=0; while(true){ if(stopflg){ break; } i++; if(i==30){ i=0; monitor.beginTask("generate", 30); } monitor.worked(1); Thread.sleep(100); } monitor.done(); } }; new ProgressMonitorDialog(shell).run(true, true, runnable); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }}
import org.eclipse.core.runtime.IProgressMonitor;import org.eclipse.jface.dialogs.ProgressMonitorDialog;import org.eclipse.jface.operation.IRunnableWithProgress;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Shell;public class TestProgress { static boolean stopflg = false; /** *循环一次 * Launch the application * @param args */ public static void main(String[] args) throws Exception{ final Display display = Display.getDefault(); final Shell shell = new Shell(); shell.setSize(500, 375); shell.setText("SWT Application"); // IRunnableWithProgress runnable = new IRunnableWithProgress(){ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("generate", 30); for(int i=0;i<100;i++){ if(monitor.isCanceled()){ return; } monitor.worked(1); Thread.sleep(50); } monitor.done(); } }; new ProgressMonitorDialog(shell).run(true, true, runnable); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }}
0 0
- Shell 窗体进度条
- 进度条窗体
- shell进度条
- Shell 进度条
- shell 进度条
- shell进度条
- shell进度条
- 进度条(shell)
- shell进度条
- shell进度条
- shell进度条
- shell进度条
- Shell窗体
- C#窗体进度条
- 进度条窗体的源代码 - Delphi
- c# 模式窗体加载进度条
- VBA窗体模拟显示进度条
- shell语法及shell进度条
- SWT样式
- Java开源 开源工作流
- Oracle数据库里面查询字符串类型的字段不为空和为空的SQL语句:
- 卷积神经网络(一):LeNet5的基本结构
- 在eclipse rcp 开发中 动态的显示视图
- Shell 窗体进度条
- MFC中CTreeCtrl控件的简单使用
- 数据挖掘实验(SAS)关联规则挖掘
- 练手小项目(5)安全卫士_程序锁
- pyqt4
- 谷歌认为每个Android迷应该使用的75个超酷app
- *** missing separator (did you mean TAB instead of 8 spaces?)或者*** missing separator的解决办法
- 1. python实现简单爬虫功能
- STM32 SPI接口的简单实现