i don't understand

I've
highlighted the offending lines, assuming I correctly identified the problem (I didn't try to compile/run the code).
public class Screen extends JPanel implements Runnable {
public static Thread thread = new Thread();
public static Ball ball; <-- this is the class member that never gets created public Screen(){
thread.start();
}
This method doesn't seem to get called anywhere, so 'ball' is null.
public void define(){
ball = new Ball(0, 0, 50, 50);
}
public void paintComponent(Graphics g){
g.setColor(new Color(0,0,0));
g.fillRect(0, 0, Frame.size.width, Frame.size.height);
g.setColor(new Color(0,50,0));
ball.draw(g); <-- which causes the null pointer exception (NPE) here (I think) }
@Override
public void run() {
while(true){
repaint();
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
What are you using to develop the code? Do you have a debugger so you can step through, that's the best way of tracking down bugs?
Hope this helps.
- stride
EDIT: Why can't I make stuff bold within a code block ffs
