| Дмитрий Волков ( @ 2007-03-27 16:36:00 |
| Current music: | Pushnoy.ru - SPLIN-IT! |
| Entry tags: | howto, java, swing, Записки новичга |
{java, swing} Записки новичга: продолжительные задачи
Интересный подпроект SwingWorker у SwingLabs.
Процитирую описание:
«
When writing a multi-threaded application using Swing, there are two constraints to keep in mind: (refer to How to Use Threads for more details):
These constraints mean that a GUI application with time intensive computing needs at least two threads: 1) a thread to perform the lengthy task and 2) the Event Dispatch Thread (EDT) for all GUI-related activities. This involves inter-thread communication which can be tricky to implement.
SwingWorker is designed for situations where you need to have a long running task run in a background thread and provide updates to the UI either when done, or while processing.
»- Time-consuming tasks should not be run on the Event Dispatch Thread. Otherwise the application becomes unresponsive.
- Swing components should be accessed on the Event Dispatch Thread only.
These constraints mean that a GUI application with time intensive computing needs at least two threads: 1) a thread to perform the lengthy task and 2) the Event Dispatch Thread (EDT) for all GUI-related activities. This involves inter-thread communication which can be tricky to implement.
SwingWorker is designed for situations where you need to have a long running task run in a background thread and provide updates to the UI either when done, or while processing.
Link: SwingWorker @ SwingLabs
Прост, юзабелен, нареканий пока нет.