Foxtrot - Easy API for JFC/Swing - Documentation: "The GUI freeze Problem
When you write Swing applications, you show a GUI to a user; the user clicks on some components (buttons, menus, etc.) to perform the desired action.
The code that executes the action is written in event listeners methods, and event listeners are always executed in the Event Dispatch Thread.
The Event Dispatch Thread is responsible for taking one event after another and processing it; the processing involves calling the event listeners's method, which are then executed. If an event listener requires a long time to be executed, then the Event Dispatch Thread cannot process the next event, which will then be waiting in the Event Queue.
If the pending event is a repaint event, the GUI cannot be repainted, so it appears to be frozen.
So resizing your window, overlapping it with another window, clicking on other components, all these events are queued but not processed until the time-consuming listener has finished.
The user feels the application has hung.
When the time-consuming listener finishes, all pending events are processed, and if they are quick to execute (like repainting events) it appears they're are executed like a storm.
Take a look at the following code.
Let's concentrate on the button's listener (the actionPerformed() method): the first statement changes the text of the button. This causes"
Tuesday, December 12, 2006
中国Java开发网 - 请教大侠们一个问题--进度条
中国Java开发网 - 请教大侠们一个问题--进度条: "1.请教大侠们一个问题--进度条 Copy to clipboard
Posted by: jlynnc
Posted on: 2002-12-07 13:22
我谢了一个ftpclient
下载文件的时候需要弹出一个进度条窗口指示进度
我把数据流的读写放到了另一个线程里,可是还是不行
一按下载按钮就像死极了一样,进度条窗口显示不完全
直到下载完成,才完全显示,不知如何解决
2.解决办法 [Re: jlynnc] Copy to clipboard
Posted by: levels
Posted on: 2002-12-08 00:52
使用SwingUtilities.invokeLater()
3.try this out [Re: jlynnc] Copy to clipboard
Posted by: snowbug
Posted on: 2002-12-08 11:50
I've been using a small library called foxtrot for a while in my swing related programming. It made my life so much easier. Basically, it allows you to invoke a time-consuming task but not block the swing UI"
Posted by: jlynnc
Posted on: 2002-12-07 13:22
我谢了一个ftpclient
下载文件的时候需要弹出一个进度条窗口指示进度
我把数据流的读写放到了另一个线程里,可是还是不行
一按下载按钮就像死极了一样,进度条窗口显示不完全
直到下载完成,才完全显示,不知如何解决
2.解决办法 [Re: jlynnc] Copy to clipboard
Posted by: levels
Posted on: 2002-12-08 00:52
使用SwingUtilities.invokeLater()
3.try this out [Re: jlynnc] Copy to clipboard
Posted by: snowbug
Posted on: 2002-12-08 11:50
I've been using a small library called foxtrot for a while in my swing related programming. It made my life so much easier. Basically, it allows you to invoke a time-consuming task but not block the swing UI"
Monday, December 11, 2006
JAVA不确定的进度条(转) - fidelhl的专栏 - CSDNBlog
JAVA不确定的进度条(转) - fidelhl的专栏 - CSDNBlog: "JAVA不确定的进度条
--------------------------------------------------------------------------------
内容:
进度条的基本用法
使用不确定模式
相关文章
sun如何使用进度条http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
相关内容:
Java 理论与实践:嗨,我的线程到哪里去了?
在 Java 应用程序中计划重复执行的任务
IBM developer kits for Java (downloads)
developerWorks Toolbox 订阅
JProgressBar 的一个细微但是重要的更新
级别:入门
John Zukowski (jaz@zukowski.net)
总裁, JZ Ventures, Inc.
2003 年 12 月
开发人员用 JProgressBar 组件向用户显示一项任务的进度。针对非常长的任务或者难于精确确定完成进�"
--------------------------------------------------------------------------------
内容:
进度条的基本用法
使用不确定模式
相关文章
sun如何使用进度条http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
相关内容:
Java 理论与实践:嗨,我的线程到哪里去了?
在 Java 应用程序中计划重复执行的任务
IBM developer kits for Java (downloads)
developerWorks Toolbox 订阅
JProgressBar 的一个细微但是重要的更新
级别:入门
John Zukowski (jaz@zukowski.net)
总裁, JZ Ventures, Inc.
2003 年 12 月
开发人员用 JProgressBar 组件向用户显示一项任务的进度。针对非常长的任务或者难于精确确定完成进�"
Sunday, December 10, 2006
Subscribe to:
Posts (Atom)