This project's goal was to create an interface that a bookstore manager could use to keep track of the inventory of his bookstore, all of his customers, and which customers were renting which books.
Tools Used:
Java Swing
for tabbed panels, buttons, Jlabels, Jscrollpane, and Jtables
Additionally, it needed to be able to add both new books and new customers to the library. All of the data was read from and saved to a txt file that served as the database.
When the application is first opened, the GUI defaults to this screen:
The data for the bookstore is automatically uploaded from a txt file with the format "Books:\n", (book data), "RentedBooks\n", (rented book data), "Customers\n", (customer data)
The books are stored in a "Book" object and the customers are store in a "Customer" object that stores the necessary data.
Clicking the "Display Customer" button displays a list of all customers in the bookstore and their stored data. If there were more customers than could fit, a JscrollPane would allow you to scroll to view more data.
Clicking "Add Customer" prompts the user to enter all of the required information for a customer, apart from what they've rented, which will default to "No Books Rented"
Hitting "Display Customer" again, we see that the new customer has been added. Additionally, it also has been added to the database.
If the user hits "Search" with no input, the customer table will not dislpay any data. If the user enters either the first, or last name, all customers with matching data in one of those fields will be displayed. Here is what happens when I type "Long", a name of one of the customers.
If the user clicks on the "Books" tab, they will be directed to a panel with a similar setup to customer. Clicking "Display Books" will display all books in the same manner as customers.
The search bar works in the exact same manner as the customer tab except it searches by book title. Here is the result for searching for "Green Book".
If the user clicks "Rent Book", it will prompt the user asking for "first name of customer", "last name of customer", and then "book title". As seen here.
If the copies was already at 0, the user would recieve a popup that read "No copies available for rent". If the customer entered a book not in the library's database, the user would recieve a popup that said "This book is not in the library". If the user typed the name of a non-existent customer, the user would receive a popup that read "Customer does not exist". After clicking "Display Books" again, you can see that the "copies" of the book has been decreased by 1 as seen below. All changes are also saved in the database.
If the user clicks "Add Book", the user is prompted for all the information of the new book.
After the user clicks "Display Books" again, the new book has been added to the table.
Finally, on the "Rented Books" tab, the user can search a customer by last name and see all the books they have rented, along with the author of those books. After creating the new user "Brock Hampton" and adding "Purple Book", I also added "Red Book" and "Blue Book" to their rentals. After searching Hampton and hitting "search", the following results are displayed.
If Hampton had not rented any books, it would have defaulted to and displayed "No Books Rented" where the title of the books are currently. Additionally, all changes in the GUI are reflected and saved in the database.