e.g.
Image image =Toolkit.getDefaultToolkit
MediaTracker mt = new MediaTracker(this);
mt.addImage(image, 0);
try {
mt.waitForID(0);
// NOW you can use the image
}
catch(Exception e) {
// ignore
e.printStackTrace();
}
Main Topics
Browse All Topics





by: CEHJPosted on 2004-02-02 at 05:45:37ID: 10252320
Please post your code. You will have to allow for the fact that images are loaded asynchronously and therefore drawImage can get called before ht eimages is loaded, therefore returning -1 for width and height