I am loading an Image resource then converting it to BufferedImage but the conversion routine uses the images width and height and until the image is fully loaded these return -1.
I use a while loop to wait but this doesn't seem the best way to do it.
Is there a better way?private Image loadCardsTileSet(){ try{ Image image = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource(Engine.CARDS_TILESET_FILEPATH)); while(image.getWidth(null)==-1){} BufferedImage img = Engine.toBufferedImage(image);