Problem with double buffering

[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.

Howdy, Stranger!

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