I think your problem is that the Graphics object being passed into the paint method is null, if you call this method just with 'repaint();' it should work.
To check if this is the problem simply add 'if (g == null)System.out.print("Graphics object Null");'

EDIT: Actually I'm pretty sure you have to do this: super.paint(g); before you use it to initialise 'ga'

04-03-2012, 06:34 AM

DarrylBurke

Re: Line2D, getting NullPointerException

1. Never use getGraphics() of a Component. Not until you have a very good uncerstainding of AWT and Swing, anyhow.
2. Never call paint() in code. As Borkpaladin has hinted, the correct way to get a painting method to run is to call repaint().
3. For Swing components, the method to override is paintComponent(...), not paint(...).