Thread: applet
View Single Post
  #2 (permalink)  
Old 05-16-2008, 05:24 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Code:
// <applet code="LoadAndDraw" width="400" height="400"></applet> import java.awt.*; import java.applet.*; public class LoadAndDraw extends Applet { Image q; public void init() { String path = "images/hawk.jpg"; // Create image object. q=getImage(getCodeBase(), path); // Load the image data. MediaTracker mt = new MediaTracker(this); mt.addImage(q, 0); try { mt.waitForID(0); } catch(InterruptedException e) { System.out.println(mt.statusAll(false)); } } public void paint(Graphics e) { e.drawImage(q, 50, 50, this); } }
Reply With Quote