Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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???
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
VineetK Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ulf and my apologies for the last post. The repaint method is working fine.
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic