Hallo Freunde! Habe schon einige varianten des Bild ladens ausprobiert.. Was mache ich bei diesem Code nun falsch, dass er ir das Bild nicht anzeigt...
[HIGHLIGHT="Java"]public class Bild extends JApplet {
private JPanel jContentPane = null;
public Graphics bild;
public Bild() {
super();
}
public void init() {
this.setSize(300, 200);
this.setContentPane(getJContentPane());
bild = getGraphics();
zeichne(bild);
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
}
return jContentPane;
}
public void zeichne(Graphics g){
Image img;
img = getToolkit().getImage("bild.gif");
g.drawImage(img,20,20,this);
}
}[/HIGHLIGHT]
LG
[HIGHLIGHT="Java"]public class Bild extends JApplet {
private JPanel jContentPane = null;
public Graphics bild;
public Bild() {
super();
}
public void init() {
this.setSize(300, 200);
this.setContentPane(getJContentPane());
bild = getGraphics();
zeichne(bild);
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
}
return jContentPane;
}
public void zeichne(Graphics g){
Image img;
img = getToolkit().getImage("bild.gif");
g.drawImage(img,20,20,this);
}
}[/HIGHLIGHT]
LG
Zuletzt bearbeitet von einem Moderator: