Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ulf and my apologies for the last post. The repaint method is working fine.
 
You showed up just in time for the waffles! And 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
reply
    Bookmark Topic Watch Topic
  • New Topic