Forums Register Login

Updating Components

+Pie Number of slices to send: Send
I am making my first "Top to Bottom" application, (an applet) which computes all of the prime numbers between two starting values. I am displaying the results in a JTextArea. I am also attempting to provide error messages and updates in the same area. I do a:
theText.setText("Computing the primes ...");
just before I do the computations and the messate does not show up. I have tried adding:
repaint();
after it but this message is skipped. I did an:
Graphics screen
...
theText.update(screen)
and while this got the message to display it also generated a NullEventException.
While I could trap the exception, that is not very clean. I am NOT currently using threads. Is this my problem?? Does Java not have enough time to update the display before my other computations have completed and they get displayed?
+Pie Number of slices to send: Send
First, you say something about how this is an applet and an application. Usually these are two different animals. I suggest that you stick to application and introduce the applet factor later.
I think to see the message you will have to implement a thread. Java will do the actual painting while waiting for events - but you aren't waiting for events yet, you are working on the computations.

+Pie Number of slices to send: Send
My apologies, I am still getting familiar with Java terminology. My old school education terms everything an application.
This is an applet. It works great, except this one text message does not display. I have considered introducing threads by since what I am doing is very linear, I didn't see the need.
+Pie Number of slices to send: Send
It's been a while since I had to do this - before Swing, I made a progress bar. In order for the progress bar to show anything, I remember I had to put it in its own thread. I wish I could remember more details for you.

+Pie Number of slices to send: Send
Try paintImmeditly() on the component after
setting the component.
I've been selected to go to the moon! All thanks to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1041 times.
Similar Threads
Character Frequency Counter in C(?)
Problems with US Robotics USB Modem (External)
please help with jsp design
res.setContentType("text/xml");
Passing Bigdecimals
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:03:46.