java graphics (original) (raw)
I wonderif anyone could explain me, when exactly does the dimenstions of the images that I load become known? Small example:
// --- the code is in a class, that extends applet Image foo = getImage(getCodeBase(),fnm); System.out.println("Image dimensions: [" + foo.getWidth + ", " + foo.getHeight + "]");
Now this prints [-1, -1], because "the width is not yet known." ((c) J2SE API). If these functions (.getHeight/getWidth) are called again, they however (sometimes!) return the correct dimensions. But that is not exactly reliable - and I can't find a decent explanation how this size determination functions!