The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Loading images in the least amount of time

Posted by Hiran on November 28, 2001 at 10:19 AM

How do I load an image quickly? For solitaire, I have to load the images of each card face. Here's my code to draw each image:

Toolkit toolkit = Toolkit.getDefaultToolkit();
Image cardFace = toolkit.getImage(cardImagePath);
g.drawImage(cardFace, borderWidth, borderWidth, dim.width - 2 * borderWidth - 1, dim.height - 2 * borderWidth - 1, this);

(Note: g is a Graphics object)

Is there any way to load the images faster? Thnx in advance.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us