This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I created a GUI using the Netbeans framework. From that interface I have a JButton, and within the actionPerformed method of that button is the following code.
The main() method is in the same class.
I tried moving it ( main() )to another class, and calling setVisible() from there to fire up the interface, hoping to have some effect
on the 'static context'.
Obviously I don't fully understand what is going on here with the 'static context', and my question would be, in this case, what does it mean?
I know what a static member is, and what a static method does, at least fundamentally.
I have a general idea that main() is static because the run-time environment will be looking for it as specified by the Standard.
Hopefully my eyes have glazed over and I am missing something simple, and that another pair of eyes will quickly point out.
Otherwise, I'm need to brush up on whatever I don't know here.
I thought this to be a good minimalist starting point regarding the posting of code.
To call a non-static method you need an instance of the class. In your case, you need an instance of CarrierTableModel (you know, new CarrierTableModel(...)). Either that, or make the method static (if possible).
This is really a beginner's question, so moving to Beginning Java.