File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes where to start threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "where to start threads" Watch "where to start threads" New topic

where to start threads

Alice B Palmer

Joined: Apr 25, 2006
Posts: 25

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.

//Create and set up the window.
frame = new LoseMe();

//Display the window.
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() {

Or does it really matter where threads are started?
Alice B Palmer

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:
subject: where to start threads
It's not a secret anymore!