posted 18 years ago
Depending on the version of java you want to use, possibly. Since you are using the Image class and the scaling looks to be constant you might consider scaling the images as or soon after you load them. The Image method 'getScaledInstance' loads asynchronously so it works better with/needs a MediaTracker which you may already be using for the loading.
The call to 'setOpaque' should be located in the class constructor; we only need to call it one time.
If you can tolerate loading the images as BufferedImages you can take advantage of software acceleration. Use 'ImageIO.read' to load and AffineTransform to scale them on the fly. One potential drawback with this kind of on–the–fly scaling is a hardware acceleration–related bug in later j2se 1.4 – 1.5 versions that causes jerky movement in a JScrollPane.
You could use the same approach to create scaled images after loading the originals
and draw them with