473,327 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Problems with Double Buffering

Hi.....I've recently created a java class that is supposed to load an image and use double buffering to reduce flickering.....when I use the proposed methods for double buffering.....i keeps on giving me a blank frame with out the image.....please advice
Feb 16 '07 #1
4 1220
r035198x
13,262 8TB
Hi.....I've recently created a java class that is supposed to load an image and use double buffering to reduce flickering.....when I use the proposed methods for double buffering.....i keeps on giving me a blank frame with out the image.....please advice
Post the code you are using.
Feb 17 '07 #2
public void update(Graphics g){
System.out.println("In Update");
offscreenImage = createImage(wb_width,wb_height);
Graphics og = offscreenImage.getGraphics();
og.setColor(getBackground());
og.setColor(getForeground());
og.drawImage(backGroundImage,0,0,imageWidth,imageH eight,this);
paint(og);


}


public void paint(Graphics g){
LoadImage();
g.drawImage(offscreenImage, 0, 0,imageWidth,imageHeight,this);
}

public Image LoadImage(){
Toolkit T = this.getToolkit();
backGroundImage = T.getImage("iraq_planning_2003.jpg");
MediaTracker imgTracker = new MediaTracker(this);
imgTracker.addImage(backGroundImage,1);

try{
imgTracker.waitForAll();
System.out.println("Image is Loaded");

}catch(InterruptedException e){

System.err.println(e);
}

return backGroundImage;
}
Feb 23 '07 #3
r035198x
13,262 8TB
public void update(Graphics g){
System.out.println("In Update");
offscreenImage = createImage(wb_width,wb_height);
Graphics og = offscreenImage.getGraphics();
og.setColor(getBackground());
og.setColor(getForeground());
og.drawImage(backGroundImage,0,0,imageWidth,imageH eight,this);
paint(og);


}


public void paint(Graphics g){
LoadImage();
g.drawImage(offscreenImage, 0, 0,imageWidth,imageHeight,this);
}

public Image LoadImage(){
Toolkit T = this.getToolkit();
backGroundImage = T.getImage("iraq_planning_2003.jpg");
MediaTracker imgTracker = new MediaTracker(this);
imgTracker.addImage(backGroundImage,1);

try{
imgTracker.waitForAll();
System.out.println("Image is Loaded");

}catch(InterruptedException e){

System.err.println(e);
}

return backGroundImage;
}
Do you have the image in the correct folder?
Feb 24 '07 #4
Do you have the image in the correct folder?
Yeah.....i made sure of that......all that happens is a blank window will appear
Mar 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
Hello I'm writting an apllication and i like to display and offscreen image. However my code doesn't seem to work. It compiles and runs properly but What i want is to associate the button of the...
3
by: Alex Glass | last post by:
I have read plenty about applying double buffering for animation and self drawn forms. Is there a way to apply it to a form with many standard controls on it (textboxes, labels etc) ?? I have...
2
by: MPowell | last post by:
Gents/Ladies, I'm doing (at least plan on ) lots of Reads and Writes across a communication channel. I'm told that for the 'receive side' it'd be prudent to implement a double buffering scheme to...
2
by: Jason | last post by:
I have created a 2d isometric game map using tiles and now I'm trying to move around my map..when i go near the edge of the map I want to redraw the map to show new parts of the map however the...
0
by: David Veeneman | last post by:
This post is for the Google archive and does not require a reply. I received an 'Invalid parameter used' error when trying to do double-buffering with the .Net SetStyles method. I used this code...
2
by: Dan Neely | last post by:
My dialog has groupboxes with slow to redraw controls, to improve the appearance I want to doublebuffer it. While I can use SetStyle() in the Dailogs constructor the setting change doesn't get...
7
by: Rain | last post by:
Hello Gurus! I really need this one to finish a module in my thesis. PLease please help me. I need a double buffer class so i can call it and use it anytime i want, the problem is everything ive...
1
by: TyBreaker | last post by:
I notice in VB 2005 that I can set a form to be double-buffered just by setting that option to true in the Form properties. I have a panel on that form but there doesn't appear to be a...
3
by: ssoffline | last post by:
hi i have an app in which i can drop objects onto a form and move them, it consists of graphics (lines), i am using double buffering to avoid filckering in the parent control which is a panel,but...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.