Original Post
Hi I've problem finding the width/height of an image loaded within a static class of mine. A small example: Kind Regards
public class Text {
private static Image[] _characters = null;
private static void load() {
_characters = new Image[26];
// Load image (containing subimages a-z) from drive.
Image img = Toolkit.getDefaultToolkit().getImage("characters.png");
// Clip and save each character to '_characters'.
// =====> How do I retrieve the width and height of "img" ?? <=====
// I need somehow to wait for the loading above to finish.
// MediaTracker can't be use within a static class, or am I wrong?
}
private static void drawString(Graphics g, String s, int x, int y) {
if(_characters==null)
load();
// Draw string to screen.
...
}
}