Have read in the java tutorials that I should be using "SwingUtilities.invokeLater" And inside the "run" method,I should be putting my calls to swingcomponents, as they are not mulltithreaded supported.
Now which of my above said 2 methods("createAndShowGui",which is called from "init" & "loadInitialData",which is called from "start"),should be put under "Run". The init method is called and executed before the applet is realized/made_visible. So for anything called in or from init you do not have to be concerned with the event dispatch thread. The start method is called by the AppletContext at the first showing and again every time the applet is restored after being minimized. You may need to make some special arrangements if you do not want to re–initialize your gui every time this happens. It is okay to load data when this (start) method is called. If the data–loading is complex or takes a long time and you want your gui to remain responsive to user interaction/use then it is wise to do the work on a background thread, not on the event dispatch thread. We use invokeLater to update the gui after realization. This is not always required. Some things like calling repaint and setting/changing text on a JLabel or text component can be done without using invokeLater. So you have to experiment to find out what you need in your applet. You can try loading the data in a background thread and if it does not update the gui properly (from the background thread) then you can use invokeLater (in the background thread) to update the gui as needed.
Where should be the listeners added,in the method("createAndShowGui") called from "init" or from the method("loadInitialData") called from "start" This is a good question. If updating the gui components will/does not trigger events that you cannot deal with then you can add them in the createAndShowGui method. If there is trouble with undesired events being triggered then you will need to make some special arrangements to avoid the side–effects. If needed you could delay adding listeners until after the initialization in loadInitialData. Or even in a call to invokeLater (as above). You just have to experiment to find what it takes to get what you want. Also, what might happen if the user starts interacting with your gui components in a way that generates events while the gui is waiting for the initialization to complete?
"javax.swing.SwingUtilities.invokeLater"- What does it do?.Does it create a thread. Yes. It places your code in the event queue. If yes,Do I have to explicitly remove it from the Applet "stop"or "destroy" methods.How ca I remove it then.. No, it is designed to be care–free. You do not have to be concerned with removing it.