aspose file tools
The moose likes Threads and Synchronization and the fly likes where to start threads Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "where to start threads" Watch "where to start threads" New topic
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: where to start threads
 
Similar Threads
How does inner class access outter class functions?
How does inner class access outter class functions?
why use static method in creating gui
Swing not working ...
GUI doesn't display -- sometimes