This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
The problem is that main is a static member so it doesn't have a "this" pointer to call regular member functions.
You probably want instantiate swingtempate and call it from the object eg:
In order to show the JFrame you will need to create an object.
Since this is the beginning Java: remember a Class defines the structure but only static members and static fields are available. An object is an instantiation of a class so all the public and private members are available (as appropriate).
It's not what your program can do, it's what your users do with the program.
The issue here is not swing. In Java we initiate instances of a class using the "new" keyword as in the following:
<NameOfClass> referenceNameOfVariable=new <NameOfClass>()
and call the methods of the class on this referenceVariable:
referenceNameOfVariable.methodName(comma separated list of method arguments)
In the code excerpt shared by you, on line no 21 , the statement written is:
ShowGridLayout frame = new ShowGridLayout();
Here, the name of class used is: ShowGridLayout . As this is not a class but a method name only so the compiler is giving error saying "cannot find ShowGridLayout".
Use the name of your class(which is swingtempate) in the above statement