this.image = image;
loaded = true; repaint();
JFrame frame = new JFrame("TrackImage"); Image image = Toolkit.getDefaultToolkit().getImage( args[0] ); StatusImage statusImage = new StatusImage( image ); frame.getContentPane().add( statusImage ); frame.setSize(300,300); frame.setVisible(true); MediaTracker tracker = new MediaTracker( statusImage ); int MAIN_IMAGE = 0; tracker.addImage(image, MAIN_IMAGE); try { tracker.waitForID(MAIN_IMAGE); } catch (InterruptedException e) {} if ( tracker.isErrorID(MAIN_IMAGE) ) statusImage.setMessage("Error"); else statusImage.loaded();
if (loaded) g.drawImage(image, 0, 0, this); else { g.drawRect(0, 0, getSize().width - 1, getSize( ).height - 1); g.drawString(message, 20, 20); }
message = msg; repaint();