30 line simple gui, simple error, need help

I am starting on a project. I have a small problem. When i "javac" the code, it displays an "inner classes cannot have static declarations". If you could help me with this (to get it to display the GUI), that would be great. Thanks, and I'll get back to you tomorrow.

I have reposted it to bring out the point that you are declaring ShowRisk as an inner class - a class within a class (each instance of the Risk class will have its own ShowRisk type defined). And the compiler is telling you that such inner classes cannot have have static methods or fields. The whys and wherefores of this are probably unimportant as, almost certainly, you have no reason to declare an inner class.

To run a program that uses a gui you would do well to follow the same technique as that employed in Oracle's Tutorial in the section Compiling and Running Swing Programs. You should also adopt the habit of using standard Java naming conventions. Variables start with a lowercase letter, so leftNumber etc.

-------------------------------

The only bit that need change from the example used in the Tutorial is that you would add an instance of your Risk panel, not of JLabel. Notice that you end up with two classes: the Risk panel class, and the application class with the main() method.

Thank you very much!

The RiskApp class is basically a piece of boilerplate that can be reused as needed. (Or extended if an application uses multiple panels). The Risk class is now cleared of the clutter and you can concentrate on its logic.