Mar 9, 2001 #1 KryptoS Programmer Feb 7, 2001 240 BE Eeeeeeeeps, can anyone give me a little example how to show images (eg jpg-files)? thanx a lot!!
Mar 11, 2001 #2 BZJavaInst Programmer Jan 17, 2001 67 US You would want to use the Image or ImageIcon classes. Look at the Java 2 API Documentation for details. Here is an example: In your Applet: public void init() { myGraph1 = getImage(getDocumentBase(), "myJPG1.jpg" myGraph2 = new ImageIcon("myJPG2.jpg" } public void paint(Graphics g) { g.drawImage(myGraph1, 10, 10, this); myGraph2.paintIcon(this, g, 200, 10); } Good luck, Brian Upvote 0 Downvote
You would want to use the Image or ImageIcon classes. Look at the Java 2 API Documentation for details. Here is an example: In your Applet: public void init() { myGraph1 = getImage(getDocumentBase(), "myJPG1.jpg" myGraph2 = new ImageIcon("myJPG2.jpg" } public void paint(Graphics g) { g.drawImage(myGraph1, 10, 10, this); myGraph2.paintIcon(this, g, 200, 10); } Good luck, Brian