Java and Threads
Posted on 2001-06-11
As a newbie, I'm stumbling through the topic Java and threads and have come across a problem
Am ultimately trying to stop a thread from executing, although my issue is with Thread.currentThread().getName());
My code draws a GUI, from which a "Start" button is clicked and spawns a number of threads. In the function that creates the threads, I have added a system out line with Thread.currentThread().getName());
The output is "Thread-2"
A separate button connecting to a different function, albeit containing the same system.out Thread.currentThread().getName()); line, gives me the following:-
I understand that this is a totally different thread.
However, how would I go about getting currentThread().getName() to give me the "Thread-2" and not "AWT-EventQueue-0" ?
Hope this all makes some sort of sense.