Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:37:03+00:00 2026-06-05T14:37:03+00:00

I have successfully created a Java class that provides database connectivity and returns a

  • 0

I have successfully created a Java class that provides database connectivity and returns a connection object. I need to use this connection object to

  1. Retrieve information from the database (which I already know how to do)
  2. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:37:04+00:00Added an answer on June 5, 2026 at 2:37 pm

    It sounds like the NetBeans GUI editor is clouding the picture. You can tame it by limiting it’s use to a single panel, as shown in this example. The default layout of JFrame is BorderLayout, so f.add(new NewJPanel()) has the effect of adding a panel to the CENTER. You can add other panels, perhaps ones having different layouts, to other areas.

    Addendum: Note also that the generated ActionListener typically calls a method having a signature such as this, where xxx is the name of the generated control:

    private void xxxActionPerformed(java.awt.event.ActionEvent evt) {}
    

    These methods are inside the class but outside the generated code fold, so they may be edited as required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully created an app that reads from a bundled .plist file and
I have created a little program that reads in a Java file and feeds
I have a Java project that uses this driver for serial communication. The driver
I have implemented an HTTPOperations class in Android that can successfully produce an HTTP
I have created a Java project in Eclipse and successfully executed it directly from
I have created a script on mac OS X and it successfully sent an
I have created many TestProjects with Visual-Studio-2010 Ultimate . All tests were executed successfully
I have used zohmg and successfully created mapper, table in HBase and test-imported my
I have a android webservice client application. I am trying to use the java
I have created custom workflow and successfully deployed it on Alfresco. I just copied

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.