Forums Register Login

Repainting jPanel in Applet

+Pie Number of slices to send: Send
I have a jApplet that contacts a web service every minute to update the content that it displays on a jPanel. When I run the applet in my NetBeans IDE it works fine, I have a countdown timer that shows when the panel will be updated and it updates at the correct time. But when I publish this applet as a Web Start or embed it as an applet, the repainting does not work. The countdown timer still works but the content of the jPanel is never updated. What is going on? Thanks

+Pie Number of slices to send: Send
Are you sure that the applet version manages to get the updated data? Applets have restrictions on the kind of network connections they can create; in general, an unsigned applet can only talk to the server it was downloaded from.
+Pie Number of slices to send: Send
Well, it connects to the service initially to get data and populate the jPanel. But it never connects again, so it never updates the jPanel. I would think that if it was able to connect the first time then being able to connect to the web service would not be the problem. I was thinking that is was some problem with actually repainting the jPanel. Do you think differently?
+Pie Number of slices to send: Send
Sounds like my first guess was wrong. Are you looking at the "Java Console" to see if you're getting any stack traces?
+Pie Number of slices to send: Send
Yea, Ive been watching the Console. I put in several system.out.println to follow the execution of everything and the Java Console from the Applet is the same as that from my NetBeans IDE. And there are no error messages. Its just not repainting as far as I can tell...
+Pie Number of slices to send: Send
Hmmm. Weirdness. Well, how is the repainting supposed to be happening? Do you have a Swing "tree model", and is it being updated in such a way that it fires change events to the view?
+Pie Number of slices to send: Send
The timer counts down and when it reaches 0 it prompts a panel.repaint(). The panel has many rectangles on it that are filled with different colors. The server call updates an array that tells the jpanel what color to paint each component. Do you want the code?
+Pie Number of slices to send: Send
Also, when I refresh the page the data stays the same. If I launch the applet again in a new tab then the data is correct but never updates after the initial load, same as before. This is really puzzling..I can see everything working in the background but nothing gets updated on the screen.
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1800 times.
Similar Threads
JSP Count down timer
Frequent repainting
Auto-submit <form> to a servlet.
How to add a Panel to my applet?
examination system : countdown timer ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:30:28.