473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

threads and privacy context pain

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)

Jul 17 '05 #1
0 1069

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Jeffrey Maitland | last post by:
Hello all, I am in the process of writing a multithreading program and what I was wondering is a sleep command in an executing function will affect the threads below it? Here is a basic example...
31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
5
by: Russell Warren | last post by:
Does anyone know the scope of the socket.setdefaulttimeout call? Is it a cross-process/system setting or does it stay local in the application in which it is called? I've been testing this and...
34
by: Kovan Akrei | last post by:
Hi, I would like to know how to reuse an object of a thread (if it is possible) in Csharp? I have the following program: using System; using System.Threading; using System.Collections; ...
31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.