Image - Beispiel

Sourcecode - Ausschnitt

Dr. M. Halfpap


import java.applet.*;
import java.awt.*;
 
public class BildMitPaint extends Applet 
{	private TextArea ivjTextArea1 = null;
	Image bild;
	int x,y = 0;
}

public void init() 
{	// user code begin {1}
		bild = getImage(getCodeBase(),"welt.jpg");
		x = this.getSize().width;
		y = this.getSize().height;
	// user code end
}

public void paint(Graphics g) 
{	g.drawImage(bild, (int) x/2-35, (int) y/5, 70, 70,this);
}