I used XAMPP to create a MySQL database. Here’s the information.
Database name is “mysql_db”
Table name is “oopproject” with 7 columns
Here’s the detail of each element.
Set username to “root” and password to “hieu.”
The MySQL library (JAR file) is included inside the source code. Open my project and associate the file with your IDE to and it will work.
Next, I'll demonstrate each feature. I’ll begin with the first one, “Add user.” We need to create a form that can accept input from users. Here’s 2 hours of my life. Yeah, I coded everything. JavaSwing sucks.
The “Reset” button will clear all text fields.
To make it simple, the “edit” feature will use the same form as the “add” feature. Instead of reusing the form, I added both to the original form.
The “delete” feature is much easier. I used JOptionPane to create a single input form.
Next is the search feature
This is the before table.
This is after doing the search.
Thanks to javax.swing.table.TableRowSorter, it’s a search feature inside the table, not the code itself.
Let's move on to the last two features Again, we need to create a form for the user input
Pressing “Thống kê” will print out a table that includes information of all contracts which have ‘start dates’ between the given period of time.
Here’s what the last feature output looks like. All credit goes to JOptionPane.