A complete Java Swing desktop application for managing hardware products and inventory with secure MySQL database integration
A complete desktop application for hardware store management built with Java Swing. The system allows admins to manage products and users, while customers can browse products, view details, and manage their shopping cart. Features secure MySQL database integration with role-based access control.
- Dual User Roles: Admin and User interfaces with distinct functionalities
- Product Management: Add, edit, delete, and browse hardware products
- User Authentication: Secure login and registration system
- Shopping Cart: Add products to cart, manage quantities, and checkout
- Admin Dashboard: Manage all products, users, and system statistics
- User Dashboard: Personal cart management and profile updates
- Profile Management: Update user information and password
- Real-time Database Sync: All changes persist to MySQL database
- Language: Java (JDK 8+)
- GUI Framework: Java Swing
- Database: MySQL
- JDBC Driver: MySQL Connector/J 8.0.33
- Database Management: XAMPP (Apache Friends)
- Java JDK (version 8 or higher) - Download
- XAMPP (Apache Friends) - Download
- MySQL JDBC Driver (automatically included in
lib/folder)
- Install and start XAMPP - ensure MySQL service is running
- Open phpMyAdmin:
http://localhost/phpmyadmin - Create a new database named
hardware store - Run the SQL script: Import
database_setup.sqlinto the database
# Option 1: Double-click compile.bat
compile.bat
# Option 2: Use command line
javac -encoding UTF-8 -cp "lib/*" -d bin src/*.java# Option 1: Double-click run.bat
run.bat
# Option 2: Use command line
java -cp "bin;lib/*" LoginAdmin Account:
- Username:
admin - Password:
admin123
Test User:
- Create a new account via the signup page
hardware-store/
βββ src/
β βββ App.java - Main application class
β βββ Login.java - Login interface
β βββ Signup.java - User registration
β βββ Dashboard.java - Role-based dashboard
β βββ User.java - User model
β βββ Product.java - Product model
β βββ DatabaseConnection.java - MySQL connection handler
β βββ UserDatabase.java - User CRUD operations
β βββ ProductDatabase.java - Product CRUD operations
β βββ Cart.java - Shopping cart operations
β βββ ManageProducts.java - Product management panel
β βββ AddProduct.java - Add product form
β βββ EditProduct.java - Edit product form
β βββ ProductDetail.java - Product details view
β βββ ViewCart.java - Shopping cart display
β βββ ViewUsers.java - User management panel
β βββ CreateUserDialog.java - Create user dialog
β βββ Profile.java - Profile management
β βββ NetworkImageLoader.java - Image loading utility
β βββ TestConnection.java - Database connection test
βββ lib/
β βββ mysql-connector-j-8.0.33.jar
βββ bin/ - Compiled class files
βββ ss/ - Screenshots directory
βββ database_setup.sql - Database schema
βββ DATABASE_SETUP.md - Detailed setup guide
βββ QUICK_START.md - Quick start guide
βββ compile.bat - Windows compile script
βββ run.bat - Windows run script
id(INT, AUTO_INCREMENT, PRIMARY KEY)full_name(VARCHAR 100)username(VARCHAR 50, UNIQUE)email(VARCHAR 100)phone(VARCHAR 20)password(VARCHAR 100)role(VARCHAR 20) - "admin" or "user"created_at(TIMESTAMP)
id(INT, AUTO_INCREMENT, PRIMARY KEY)name(VARCHAR 100)description(TEXT)price(DECIMAL 10,2)stock(INT)category(VARCHAR 50)image_url(VARCHAR 500)created_at(TIMESTAMP)
id(INT, AUTO_INCREMENT, PRIMARY KEY)username(VARCHAR 50)product_id(INT, FOREIGN KEY)quantity(INT)added_at(TIMESTAMP)
- Login β Dashboard shows admin menu
- Manage Products: View all products in table format
- β Add new products with full details (name, price, stock, category)
- βοΈ Edit existing products
- β Delete products from inventory
- Manage Users: See all registered customers
- My Profile: Update personal information and password
- Sign Up β Create account with credentials β Login
- Browse Products: View all available hardware products
- π Click product β View detailed information
- π Add to cart with desired quantity
- My Shopping Cart: Manage your cart
- Remove items
- View total price
- Manage quantities
- My Profile: Update personal information
Backend:
- Java 8+ Object-Oriented Programming
- MySQL Relational Database
- JDBC Connection Pooling
Frontend:
- Java Swing Components (JFrame, JPanel, JTable, JButton)
- Event-Driven Architecture
- Model-View-Controller (MVC) Pattern
Database:
- XAMPP MySQL Server
- Automatic Schema Creation
- Persistent Data Storage
The application comes pre-loaded with default products:
- Hammer - $25.99 (50 units)
- Screwdriver Set - $35.50 (30 units)
- Power Drill - $89.99 (20 units)
Admin credentials: admin / admin123
| Issue | Solution |
|---|---|
| Database connection failed | Ensure XAMPP MySQL is running on port 3306 |
| "hardware store" database not found | Create database in phpMyAdmin or run database_setup.sql |
| Compilation errors | Verify JDK installation and JDBC driver in lib/ folder |
| Port already in use | Change MySQL port in DatabaseConnection.java |
| Images not loading | Check internet connection (images loaded from Unsplash) |
This project demonstrates:
- β Desktop GUI Application Development
- β Database Design and SQL
- β JDBC Connection Management
- β CRUD Operations Implementation
- β User Authentication & Authorization
- β Role-Based Access Control
- β Event-Driven Programming
- β Object-Oriented Design Principles
- Order processing and checkout system
- Order history tracking per user
- Email notifications on purchase
- Advanced product search and filtering
- Password encryption with BCrypt
- Product categories hierarchical management
- Sales reports and analytics dashboard
- Export data to Excel/PDF format
- Multi-image product gallery
- Customer reviews and ratings system
For setup help, refer to:
QUICK_START.md- Fast setup guideDATABASE_SETUP.md- Detailed database configuration
Educational Use Only - 2024
Built with β€οΈ using Java & MySQL
A complete desktop application for modern hardware store management
id(INT, AUTO_INCREMENT, PRIMARY KEY)name(VARCHAR 100)description(TEXT)price(DECIMAL 10,2)stock(INT)category(VARCHAR 50)image_url(VARCHAR 500)created_at(TIMESTAMP)
id(INT, AUTO_INCREMENT, PRIMARY KEY)username(VARCHAR 50)product_id(INT, FOREIGN KEY)quantity(INT)added_at(TIMESTAMP)
- Login β Dashboard shows admin menu
- Manage Products: View all products in table
- Add new products with details
- Edit existing products
- Delete products
- View Users: See all registered users
- My Profile: Update your information
- Sign Up β Create account β Login
- View Products: Browse available products
- Click product β View details
- Add to cart with quantity
- My Cart: View cart items
- Remove items
- See total price
- My Profile: Update your information
- Language: Java 8+
- GUI: Java Swing
- Database: MySQL (via XAMPP)
- JDBC Driver: MySQL Connector/J 8.0.33
- Images: Unsplash (network images)
The system includes 3 default products:
- Hammer - $25.99 (50 in stock)
- Screwdriver Set - $35.50 (30 in stock)
- Power Drill - $89.99 (20 in stock)
Database connection failed:
- Ensure XAMPP MySQL is running
- Verify database "hardware store" exists
- Check MySQL credentials in DatabaseConnection.java
Compilation errors:
- Ensure JDK is installed:
java -version - Check JDBC driver is in lib/ folder
- Use UTF-8 encoding:
-encoding UTF-8
Images not loading:
- Check internet connection (images from Unsplash)
- Images will load as placeholders if offline
- Order processing and checkout
- Order history tracking
- Email notifications
- Advanced product search and filters
- Password encryption (BCrypt)
- Product categories management
- Sales reports and analytics
- Export data to Excel/PDF
- Multi-image product gallery
- Customer reviews and ratings
This project is for educational purposes.
Hardware Store Management System - Java Project

















