RE: [Java][Source]Runescape Loader - Start making your own bot 12-29-2012, 08:59 PM
#4
(12-28-2012, 11:47 PM)Jacob Wrote: Thanks for your comments Deque! I didn't use anything from SwingUtilties because I everything is running on a single thread, so I figured there was no issue with concurrency.
The tasks have to be scheduled on the EDT. If you don't start the GUI with invokeLater you might run into problems even if you don't use any threads by yourself (the JVM uses several threads though).
These kind of bugs are very hard to fix, because they occur only sometimes or only on some machines and you might waste a lot of time with finding the reason. It is sad that most Swing tutorials do this wrong.
(12-28-2012, 11:47 PM)Jacob Wrote: Although, I have a question that even Java Docs can't answer properly. What is the real difference between SwingUtilties.invokeLater and SwingUtilities.invokeAndWait?
invokeLater schedules the tasks and returns, invokeAndWait does the same, but waits for the tasks to be finished and returns afterwards.
You use invokeAndWait for applets, so that the init method of that applet can not return before the GUI is created.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.
Expressed feelings are just an attempt to simulate humans.
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)