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
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.
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?
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...
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?
posted 10 years ago
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.
I just had the craziest dream. This tiny ad was in it.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop