| Author |
where to start threads
|
Alice B Palmer
Greenhorn
Joined: Apr 25, 2006
Posts: 25
|
|
Hi, I've been trying to use threads, but I keep having problems. I found this bit of code and was wondering if I should be starting my threads within the public void run() int he main(String[] args) bit (underneath the createAndShowGUI). /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); //Create and set up the window. frame = new LoseMe(); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); //Display the window. frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } Or does it really matter where threads are started?
|
 |
Alice B Palmer
Greenhorn
Joined: Apr 25, 2006
Posts: 25
|
|
Sorry, I now understand how the code button works. Let me try it again.
|
 |
 |
|
|
subject: where to start threads
|
|
|