Connect GUI to database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • araujo2nd
    New Member
    • Oct 2007
    • 24

    Connect GUI to database

    I am creating a library system at the moment using netbeans, i have used the GUI builder to create my main screen, which basically has menu button (file, members, books, loan, help)

    I have managed to get the menu items (for example under members it says "add a new member" and i have managed to get it so that when i click it, it takes me to the AddMember GUI i created in the gui builder).

    Im really struggling on how to get the button called "view all members" to show all the members in the database...shou ld i create a class that reads the database or can i do it directly from the ActionPerformed function

    Many thanks in advanced
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    Create the class and instantiate an object and/or call the appropriate methods from the actionListener. This way, you separate your GUI code from your DB code and can maintain (or reuse) each separately.

    Comment

    • araujo2nd
      New Member
      • Oct 2007
      • 24

      #3
      How would i go about creating the class??

      Do i need seperate classes to view the database, edit the database etc

      Comment

      Working...