Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show images

Status
Not open for further replies.

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!!
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top