I'm just bumbling my own way through an awt based prog that controls vtrs
and I came accross the problem of constantly updating a text field with
the time code read from the target vtr machine.
I wrote a another simple class that extended Thread and the idea was that
this class was run and every 30 milliseconds or so it updates the text
field. No can do though as the text field is declared private. I decided
not to change its access as I'm sure that Netbeans has set it private for
good reason.
Anyway, I dumped my threaded class and implemented Runnable on the class
that generates the awt stuff. In the main method at the moment there is
something like this...
BigZSonyGadget gadget = new BigZSonyGadget();
gadget.show();
Thread thread = new Thread(gadget);
thread.start();
In the run() method I've just thrown in the code to get data from the
serial port, process the data into a timecode object and then extract a
nice formatted String of the current timcode.
Fine... I don't have a vt to hand but this should all work. but!
(there is always a but)
What if I wanted to change several text fields or other components? Since
these components are private does that mean I cannot write a few threading
classes to update them?
I could concievably write all the code to do this within my now threading
BigZGadget class but as the thread itself sleeps every 30 milliseconds
(approx the duration of one frame) I could come unstuck timing wise.
--
/* Hugh Lutley aKa Spewy
* This message was created on either
* Mandrake 9.2 Linux on Athlon XP <- Gnome 2.4 ->
* Slackware 9.1 Linux on P166 <- Command Line Zone ->
*/
(created in ViM)