Can someone please help me? I need t know why this piece of code causes a null pointer exception in an APPLICATION but not an applet. The class extends Canvas.
Image drawImage; Graphics g;
public TestDraw() {
drawImage = createImage(getWidth(), getHeight()); g = drawImage.getGraphics(); // <-- causes the null pointer exception addMouseListener(this); addMouseMotionListener(this); } Please help me, this is for double buffering a canvas in an application. It works for an applet so I dont know