Get rid of the NumbersTest class and use the Display class.
Type: Posts; User: Norm
Get rid of the NumbersTest class and use the Display class.
I think the link I posted in #10 discusses this. The Display class is an inner class. You need an instance of the NumbersTest class to be able to create a Display class object.
Why not get rid of...
Out of an inner, non static class.
Why do you have the NumbersTest class?
That says what the problem is. A static method can only be in a static or top level class.
Move the main method or make the class it is in static.
Why do you have the NumbersTest class?
Why...
You can read here about nested and inner classes:
Nested Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
You need to decide if you want either of those or if you...
You would need a reference to the instance of the Display class.
Your nested classes will be a problem. An inner class would be able to see the variables of the class that it is in.
The static...
What class is the paintComponent method in?
Also you need to set String that is to be shown. The handlers are only setting a local variable.
objectReference.repaint();
Calling repaint() will cause the java program to call the paintComponent method very soon afterwards.
You will have to tell the paintComponent method what String you want it to draw.