i have a problem in my paint class
<p>this is my code...</p>

<pre><code>public class   Paintexample extends Applet{
    private Graphics g;
    JPanel panel;

    public void init()
    {
        this.setLayout(new BorderLayout());
        this.panel=new JPanel();
        this.panel.setPreferredSize(new Dimension(1024,500));
        this.add(panel);
        g=this.panel.getGraphics(); 
    }
    public void Painter(Graphics g2)
    {
        g2=this.panel.getGraphics();
        g2.setColor(Color.black);
        g2.drawRect(50, 50, 400, 400);
    }

}
</code></pre>

<p>the computer write this :</p>

<blockquote>
  <p>Exception in thread "main"
  java.lang.NullPointerException
        at Paintexample.Painter(Paintexample.java:27)
        at Paintexample.init(Paintexample.java:22)
        at Main.main(Main.java:15)</p>
</blockquote>

<p>I don't know way the applet go's down....
the graphics does not works.....
he said the graphics are not init...</p>
