This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Applets and the fly likes Repainting of applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Repainting of applets" Watch "Repainting of applets" New topic
Author

Repainting of applets

N SRao
Greenhorn

Joined: Nov 13, 2001
Posts: 11
Hi,
I am running the applet which has menubar,toolbar with lot of images and where user can drag and drop the images on the panel provided in the applet itself. My problem is when ever i refresh the screen by clicking the refresh button on the browser the entire applet will be appear distorted with the toolbar, menubar, images and all the other panels in the applet will appear double and none of the events will be fired.
so kindly let me know what will be the solution
thanks
subba
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Invoking the browser's refresh probably repaints damaged or unprocessed regions of the browser space. Your applet's repaint() method should get called eventually, and the system will then "decide" which areas need repainting.
repaint() in the Applet class calls update(), which blanks the display area and draws a filled rectangle; this is followed by a call to paint() which does the rendering.
It may be the code you are using doesn't have the paint() method implemented with this is mind. Sometimes people will override the update() method to eliminate the screen wash, but forget to clear the screen some other way before redraw. Then you get what looks like a superimposition of two views on one space.
Take a second look at the paint() code with this in mind.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
GeeCON Prague 2014
 
subject: Repainting of applets