Beitrag 267 von 610 (44%) | Antworten Beitrag schreiben | Anfang zurück weiter Ende |
|
Hallo,
ich habe ein Problem beim Einbinden eines Images im Applet,
Der code:
Image img;
private void jbInit() throws Exception {
this.setSize(new Dimension(400,300));
img = this.getImage(getCodeBase(), "welcome.gif");
}
public void paint(Graphics g) {
g.drawImage(img, 10, 10, this);
System.out.println("Nach ausgeben!!!");
}
Die Fehlermeldung:
java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Applet.java:106)
at Bild1.jbInit(Bild1.java:21)
at Bild1.init(Bild1.java:12)
at Bild1.main(Bild1.java:38)
Exception occurred during event dispatching:
java.lang.NullPointerException
at sun.awt.windows.WGraphics.drawImage(WGraphics.java:383)
at Bild1.paint(Bild1.java:25)
at sun.awt.RepaintArea.paint(RepaintArea.java:298)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:193)
at java.awt.Component.dispatchEventImpl(Component.java:2665)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
Har jemand ne Ahnung???