image = getImage(getClass( ).getResource(getParameter("image"))); tracker = new MediaTracker(this); tracker.addImage(image, MAIN_IMAGE);
if (loaded) g.drawImage(image, 0, 0, this); else { g.drawRect(0, 0, getSize().width - 1, getSize( ).height - 1); g.drawString(message, 20, 20); }
repaint( ); try { tracker.waitForID(MAIN_IMAGE); } catch(InterruptedException e) {} if (tracker.isErrorID(MAIN_IMAGE)) message = "Error"; else loaded = true; repaint( );
if (!tracker.checkID(MAIN_IMAGE)) { thread = new Thread(this); thread.start( ); }
thread.interrupt( ); thread = null;