05 Multithreadng - Threads and Swing
05 Multithreadng - Threads and Swing
Multithreading
Contents
I.Simulation
Solution
1.Developing
a Non-Thread-Safe
Solution
2.Observing the Problem
3.Correcting the Problem
1. Developing a Non-Thread-Safe
Solution
1.1. The Main Class
1.2. Developing the View
1.3. Adding Listener to the Button
Solution
1.Developing
the View
2.Adding Listeners to the Menu Items
SwingWorker
Defining Result Type and Progress Data Type
Developing the Text Reading Thread
Using SwingWorker
The
Using SwingWorker
Since
Using SwingWorker
Override
When
swObj.execute()
Worker Thread
swObj.doInBackground()
Do the job
swObj.process()
swObj.done()
The get() does not throw
a CancellationException
swObj.publish()
Progress
Developing done()
Run
Ignore
References
1.Core