Problem with double buffering - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Problem with double buffering

DysartDysart Posts: 35Member
[b][red]This message was edited by Dysart at 2005-10-25 18:59:33[/red][/b][hr]
Here's the deal I'm implementing a card game for a project.
Now I'm having a problem on drawing the cards image on the component(I'm using swing), they apear to slow on the component.
How do I make the cards apear more faster.

Here's the sourcecode for the paintComponent method:
public void paintComponent(Graphics g) {

Toolkit kit = Toolkit.getDefaultToolkit();
Image im = kit.getImage("King.gif");

public void paintChildren(Graphics g) {
Toolkit kit = Toolkit.getDefaultToolkit();

if( !acert ){



And the method that draws the cards in Class Interface
public void draw(Graphics g,Toolkit kit,MyPanel mypanel)

for (int i = 0; i < 13; i++){
Image im = kit.getImage((String)images.get(i));
mypanel.repaint();//this should speed up the process :S



I know that in theory I should put all the card images on the memory and then draw them into the screen, but since java is object oriented there must be a simpler way, I think :S.

Thanks in advance.

Sign In or Register to comment.