Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Alright, so I have my GUI, which works fine. I have my database in JDBC, which b

ID: 3641004 • Letter: A

Question

Alright, so I have my GUI, which works fine. I have my database in JDBC, which behaves fine over there. However, I haven't the slightest idea how to display the information from the database in my GUI. Furthermore, I'm not sure of the extra code needed, if any, to do so. I also want to be able to take user input and update the database, but again, I'm having trouble linking the two together.

Most places I've searched weren't very helpful, either because I couldn't see where the two tied together, or because they were so far different I couldn't see any helpful similarities. Anyone know what I need to link them together? As in, what do I need to do to use an actionListener on a button to make the database how do I make the "add record" button update the database?

Explanation / Answer

There are lots of ways to load information. It depends how you want to retrieve it in your program logic. Let's say if you want to search a employee in a database and show in GUI.

1. write Employee object class (fname,lname..etc..) in seperate file

2. create EmployeeGUI class and add search button ActionListener

3. under ActionListener call method searchEmployee

4. Write searchEmployee Method for EmployeeGUI class.

Process for searchEmployee method

1. Connect to Database and run the query ( look for java JDBC connectin in java tutorials)

2. If record found initiate Employee class and store information collected from database.

3. Once its stored use setText() method for displaying data in JTextfield from employee object in GUI class.

4. close the connection. ( important to close or database will shut your program out from running querys)

Read lots of JDBC tutorials.. it takes time.. DON't FORGET TO RATE!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote