Home arrow static arrow Java Programming [Archive] - multiple threads?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - multiple threads?
This topic has 1 reply on 1 page.

Registered: 6/21/04
multiple threads?  
Jun 23, 2004 6:13 AM

I'm new to Java and programming in general so this may be obvious to you veterans but it's like pulling teeth to me. Any help you could give me would be greatly appreciated.

Here's my situation.

I have an application in which I create a handfull of arrays by tokenizing a text file. I would like to hit a button and have each of the array's values be shown in a JLabel at some time interval (determined by one of the arrays). Im have the basics already done. I can hit the button and update the labels to one of the array's values.

My question is:

How should I structure the problem so that when I hit the button, valueA[10] and valueB[10] etc. always show in sync (as opposed to valueA[10] showing when valueB[11] is showing)? Can I place the update method for each value in the same for loop? Should I place each one in it's own thread?

I have not written any of the "timed" code yet, I'm just anticipating a problem and want to start out heading in the right direction.

Thanks in advance for your help


Registered: 01-10-05
Re: multiple threads?  
Jun 23, 2004 7:11 AM (reply 1 of 1)

You shouldn't need threads to do this, just use the java.swing.Timer(). If the assignment is actually more than you've indicated and you need threads you should read the [url=http://java.sun.com/docs/books/tutorial/essential/threads/index.html]Threads section of the Java Tutorial[/url]
This topic has 1 reply on 1 page.