I'm not sure if my refactoring is right on EDT issues.
posted 9 years ago
It's an applet. In the applet's start() method, create a login dialog, if the user fill the right password, build the main screen. The heavy task is login() . The original code like this:
I think it's wrong to do GUI stuff in a worker thread. So I change it like this.
The super.start() seems useless, so I delete it. Also I think the menuBar should be added after the user login.
When the user press the Login button, the heavy task login() start. It was placed in a worker thread too. After that done, delete the login screen and add the mainPanle. These things are all put in the worker thread. I think it's useless to dispatch the login() to a worker thread. Because the mainPanle is not visible so far. So the user is not allowed to do anything. Another thing I concern is GUI stuff should be done on EDT. So I draw the worker thread out, and put all things in the EDT. What's your opinion about my changes?