|I have a Masters in computer science. I can answer questions on core J2SE, swing and graphics. Please no questions about JSP or J2ME.|
First, you can't name a class sunchronized. It's a keyword in Java. Typically you would use 2 classes for 2 threads if you wanted them to behave differently. Since t1 and t2 are kept out of scope from
Those constructors are not useful for non-subclasses. If you don't subclass Thread you should use the Thread(Runnable target) or Thread(Runnable target, String name) constructor. If you subclass Thread
1. Creating a thread allows you to run multiple pieces of code at the same time. This can use multiple processors, or can allow one thread to continue while another one is waiting on a response or resource
I don't see what JLabel, JButton, and JTextField have to do with drawing a line. Unless perhaps you want a bit more interactivity. In any case you will want to create a custom component to draw the
1. It is possible to put any object in a synchronized block. When a thread enters a synchronization block, it is said to have a lock on that object. That lock is released once the block is left.