// ImageDisplay.java
// Loading and scaling an image and an icon
// APPLET CODE="ImageDisplay" WIDTH=600 HEIGHT=550
import java.awt.*;
import java.applet.Applet;
import javax.swing.*;

public class ImageDisplay extends JApplet {
	private Image bunsen;
	private ImageIcon bunsenIcon;

	// load the image when the applet begins
	public void init( ) {
		bunsen = getImage( getDocumentBase( ), "bunsen0.jpg" );
		bunsenIcon = new ImageIcon( "bunsen0.jpg" );
	}

	// display the image
	public void paint( Graphics g ) {
		// draw original size
		g.drawImage( bunsen, 0, 0, this );
	
		// draw at 120% size
		int w = bunsen.getWidth( this );
		int h = bunsen.getHeight( this );
		g.drawImage( bunsen, 0, 250, ( int ) ( w * 1.2 ), ( int ) (h * 1.2 ), this );

		// draw the icon using its paintIcon method
		bunsenIcon.paintIcon( this, g, 200, 0 );
	}
}