First off, use of JApplet is prefferable over Applet since it supports Swing component architecture. So let your BallWorld class extend JApplet instead, it is essentially the same thing.
Then you should maybe override the init() method in your BallWorld class to set up you applet. You should instansiate your variables in init() instead of where you declare them.
I noticed that you call Thread.sleep in your paint method and then call repaint. This is not how you should set up animations. Have a look at the class javax.swing.Timer which lets you define a timer that will call a method a given number of times per second or something. You can then directly call paint or repaint each time the timer calls your callback method.
I don't know exactly why you get the error. Do you have a stack trace?