1. You create a "Graphics" variable called "graphics", then you never set it to anything. Ergo, the NullPointerException. That's okay, though, because the next thing you should do is...
2. Move the "malen()" method to your outer class. Change its name and signature to:
1
| public void paint(Graphics g) |
3. Add the following line at the end of the new "paint(Graphics g)" method:
Now, I'm sure you're wondering about the instructions above. The problem you're having is probably based on a misunderstanding of how painting works. You see, the applet only repaints itself from the method "paint(Graphics g)". That method is called by the operating system whenever it feels like it needs to update the applet. However, you may occasionally want to update it manually, so the "repaint()" call tells the OS to call "paint(Graphics g)".
Let me know if you have any questions. :-)