C#中使用Dictionary实现Map数据结构――VC编程网
2014-01-02 20:24
387 查看
这样一段代码,希望能够在执行的时候,显示一个进度条。但是每次进度条都要等到执行完了才显示出来,为什么呢?
Progress p=new Progress(poi); Thread th=new Thread(p); try{ th.start(); //一段需要很长时间的代码 //th.interrupt(); }catch(Exception e){ //th.interrupt(); }
package com.ui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.Timer; public class Progress implements Runnable { Timer tm; ProgressMonitor pm; JFrame poi; int i; public Progress(JFrame poi){ this.poi=poi; } public void run() { ActionListener actionListener=new ActionListener(){ public void actionPerformed(ActionEvent e){ pm.setProgress(++i==100?1:i); } }; System.out.println(123); tm=new Timer(200,actionListener); pm=new ProgressMonitor(poi,"","正在导入,请稍候...",1,100); pm.setMillisToDecideToPopup(0); pm.setMillisToPopup(0); tm.start(); } }
相关文章推荐
- C#中使用Dictionary实现Map数据结构——VC编程网
- C#中使用Dictionary实现Map数据结构
- C# 使用Dictionary、linq实现根据集合里面的字符串进行分组
- C# 游戏开发中使用 Dictionary 实现消息分发
- C#中使用Dictionary实现Map数据结构
- 如何使用C#实现网易博客中圈子用户数据的采集
- c# 使用ActiveDesktop实现壁纸切换,适合大部分图片格式
- 在C#中使用异步Socket编程实现TCP网络服务的C/S的通讯构架(一)----基础类库部分
- C# 使用重载消息处理函数的方式,实现没有标题栏的窗体的拖动。
- C# 使用MEF动态加载不同的userControl,并实现不同userControl之间通信
- 要使用C#实现一个ActiveX控件
- Code19 使用C#实现如何在运行时传递参数给水晶报表
- C#使用Socket实现一个socket服务器与多个socket客户端通信
- 如何使用 C# .NET 在 ASP.NET 应用程序中实现基于窗体的身份验证
- 1ActiveMQ使用 2ActiveMQC#Client实现 3ActiveMQC++Client实现通讯 4 ActiveMQJavaClient实现
- C#、VB.NET使用HttpWebRequest访问https地址(SSL)的实现
- 使用Mutex实现程序单实例运行(c#)
- C#:泛型集合—Dictionary<K,V>使用技巧
- C# 简单链表的实现下(使用泛型)
- [C#] .NET4.0中使用4.5中的 async/await 功能实现异