dcsimg
URGENT PLEASE HELP!!!I am using double buffering in my applet, but i want to get rid of it.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Junaid_Mohammad
Posted On:   Wednesday, July 17, 2002 06:53 AM

I have wrote an applet that will display a fish swimming around in a fishbowl. But when i display it on the HTML web page, called up by a servlet - applet - petApplet.class The image isn't been displayed. I am trying to get rid of the Double buffering, that i am using, but to no success. I have done the following, in order to display the image of the pet. Please can you tell me how i can rewrite the following code without double buffering, as applet supports Double buffering. Image offscreenImage; Graphics offscreenG; ............ offscreenImage = createImage(imageWidth = vPet[0].getWidth(this),imageHeight = vPet[0].getHeight(thi   More>>

I have wrote an applet that will display a fish swimming around in a fishbowl. But when i display it on the HTML web page, called up by a servlet - applet - petApplet.class


The image isn't been displayed. I am trying to get rid of the Double buffering, that i am using, but to no success. I have done the following, in order to display the image of the pet. Please can you tell me how i can rewrite the following code without double buffering, as applet supports Double buffering.


Image offscreenImage;


Graphics offscreenG;



............



offscreenImage = createImage(imageWidth = vPet[0].getWidth(this),imageHeight = vPet[0].getHeight(this));


offscreenG = offscreenImage.getGraphics();


Thanks

Junaid

   <<Less

Re: URGENT PLEASE HELP!!!I am using double buffering in my applet, but i want to get rid of it.

Posted By:   Axel_Richter  
Posted On:   Wednesday, July 17, 2002 07:58 AM

Where are you drawing the image? May be vPet[0] is a image, then



createImage(int Width, int Height)



only creates a empty image for drawing. You must do



offscreenG.drawImage(vPet[0], 0, 0, this);



or whatever to draw the image.



If you have draw the image then may be you must use a MediaTracker to wait for the image.


...
void waitForImage(Image image) {
try {
// Use a media tracker object to wait until all the pixels
// have been retrieved.
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image, 0);
tracker.waitForID(0);
} catch (Exception e) {
e.printStackTrace();
}
}
...
About | Sitemap | Contact