Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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.
 
Squanch that. And squanch this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic