File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Changing the display of an applet dynamically on a web application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Changing the display of an applet dynamically on a web application." Watch "Changing the display of an applet dynamically on a web application." New topic
Author

Changing the display of an applet dynamically on a web application.

VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
I am building a simple web-app with an applet embedded in a JSP. This applet on being loaded the first time, displays a 2D image. It also has a button on it, which on being clicked, contacts a servlet. The servlet now sends a new set of co-ordinates for a new shape , to the applet.

Now when I run the applet as a standalone applet, the communication works fine, the new image is drawn over the default image. But once the applet is loaded on being embedded in the JSP, the image change doesn't take place. The image doesn't change even after refreshes of the page.

Any ideas how to achieve this task???


Copy Paste is a design error!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41114
    
  45
How is the drawing being done - in a paint or paintComponent method? Is the calling of those methods being triggered after obtaining the new data? If not, you may want to insert appropriate "repaint" or "update" method calls.


Ping & DNS - my free Android networking tools app
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
I am using the paint method. I have tried using the repaint and update method, but they don't help.

As you can see, one rectangle is drawn when the the apllet is loaded for the first time. The second rectangle has a variable result, which is obtained from the servlet, after the button on the applet is hit. The mechanism is working fine when applet is run as a standalone app, but fails when embedded in the JSP.
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Thank you Ulf and my apologies for the last post. The repaint method is working fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing the display of an applet dynamically on a web application.
 
Similar Threads
How to load an image in applet from web server
Struts + Applet
Writing Image from Applet
how to read file into applet in weblogic server
problem in displaying image