I have successfully created a Java class that provides database connectivity and returns a connection object. I need to use this connection object to
- Retrieve information from the database (which I already know how to do)
- I need to use it in the action event source code behind the button control
Unfortunately, I am using NetBeans and some auto generated code to build the GUI, and my question is simple:
When you create a class, you need to instantiate it and then call the method. Where do I instantiate this class in my form? Do I do it in the main, since it is the entry point of all programs, or do I do it behind the code for the button. I am a novice so please understand.
When I created the project, I created a main class too, and then I added a form to it. I then created a different project which is a class lib and added that to my project. How do I link the two together?