By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,638 Members | 2,249 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,638 IT Pros & Developers. It's quick & easy.

threads and privacy context pain

P: n/a
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();;
Thread thread = new Thread(gadget);

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)

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.