清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import java.awt.*; import java.awt.image.*; public class ImageCanvas extends Canvas { Image image; public ImageCanvas(String name) { MediaTracker media = new MediaTracker(this); image = Toolkit.getDefaultToolkit().getImage(name); media.addImage(image, 0); try { media.waitForID(0); } catch (Exception e) {} } public ImageCanvas(ImageProducer imageProducer) { image = createImage(imageProducer); } public void paint(Graphics g) { g.drawImage(image, 0,0, this); } public static void main(String argv[]) { if (argv.length < 1) { System.out.println ("usage: ImageCanvas.class [image file name]"); System.exit(0); } Frame frame = new Frame(argv[0]); frame.setLayout(new BorderLayout()); frame.add("Center", new ImageCanvas(argv[0])); frame.resize(400,400); frame.show(); } }