Skip to content

About

A complete Java Swing desktop application for managing hardware products and inventory with secure MySQL database integration

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hardware Store Management System Banner

πŸ› οΈ Hardware Store Management System

A complete Java Swing desktop application for managing hardware products and inventory with secure MySQL database integration

Desktop Java Swing MySQL


πŸ“Œ Overview

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.

🎯 Key Features

  • 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

πŸ’» Tech Stack

  • Language: Java (JDK 8+)
  • GUI Framework: Java Swing
  • Database: MySQL
  • JDBC Driver: MySQL Connector/J 8.0.33
  • Database Management: XAMPP (Apache Friends)

πŸ“Έ Screenshots

Login

Login screen

Create Account

Create account screen

Login Success

Login success screen

Dashboard

Dashboard screen

User Dashboard

User dashboard screen

Browse Products

Browse products screen

Product Details

Product detail screen

Add to Cart

Add to cart screen

Shopping Cart

Shopping cart screen

Product Management

Product management screen

Add Product

Add product screen

Edit Product

Edit product screen

All Products

All products screen

Update Success

Product update success screen

User Profile

User profile screen

My Profile

My profile screen

Manage Users

All users screen

Create New User

Create new user screen

View All Users

View all users screen

πŸš€ Quick Start

Prerequisites

  1. Java JDK (version 8 or higher) - Download
  2. XAMPP (Apache Friends) - Download
  3. MySQL JDBC Driver (automatically included in lib/ folder)

Installation Steps

Step 1: Setup Database

  1. Install and start XAMPP - ensure MySQL service is running
  2. Open phpMyAdmin: http://localhost/phpmyadmin
  3. Create a new database named hardware store
  4. Run the SQL script: Import database_setup.sql into the database

Step 2: Compile the Project

# Option 1: Double-click compile.bat
compile.bat

# Option 2: Use command line
javac -encoding UTF-8 -cp "lib/*" -d bin src/*.java

Step 3: Run the Application

# Option 1: Double-click run.bat
run.bat

# Option 2: Use command line
java -cp "bin;lib/*" Login

πŸ” Default Credentials

Admin Account:

  • Username: admin
  • Password: admin123

Test User:

  • Create a new account via the signup page

πŸ“ Project Structure

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

πŸ’Ύ Database Schema

users table

  • 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)

products table

  • 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)

cart table

  • id (INT, AUTO_INCREMENT, PRIMARY KEY)
  • username (VARCHAR 50)
  • product_id (INT, FOREIGN KEY)
  • quantity (INT)
  • added_at (TIMESTAMP)

🎯 Usage Guide

πŸ‘¨β€πŸ’Ό As Admin (admin/admin123)

  1. Login β†’ Dashboard shows admin menu
  2. 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
  3. Manage Users: See all registered customers
  4. My Profile: Update personal information and password

πŸ‘€ As User (Create via Signup)

  1. Sign Up β†’ Create account with credentials β†’ Login
  2. Browse Products: View all available hardware products
    • πŸ” Click product β†’ View detailed information
    • πŸ›’ Add to cart with desired quantity
  3. My Shopping Cart: Manage your cart
    • Remove items
    • View total price
    • Manage quantities
  4. My Profile: Update personal information

πŸ”§ Technology Details

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

πŸ“¦ Sample Data

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

⚠️ Common Issues & Solutions

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)

πŸŽ“ Learning Outcomes

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

πŸš€ Future Enhancements

  • 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

πŸ“ž Support

For setup help, refer to:

  • QUICK_START.md - Fast setup guide
  • DATABASE_SETUP.md - Detailed database configuration

πŸ“„ License

Educational Use Only - 2024


Built with ❀️ using Java & MySQL

A complete desktop application for modern hardware store management

- `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)

products table

  • 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)

cart table

  • id (INT, AUTO_INCREMENT, PRIMARY KEY)
  • username (VARCHAR 50)
  • product_id (INT, FOREIGN KEY)
  • quantity (INT)
  • added_at (TIMESTAMP)

🎯 Usage Guide

As Admin (admin/admin123)

  1. Login β†’ Dashboard shows admin menu
  2. Manage Products: View all products in table
    • Add new products with details
    • Edit existing products
    • Delete products
  3. View Users: See all registered users
  4. My Profile: Update your information

As User (Sign up to create)

  1. Sign Up β†’ Create account β†’ Login
  2. View Products: Browse available products
    • Click product β†’ View details
    • Add to cart with quantity
  3. My Cart: View cart items
    • Remove items
    • See total price
  4. My Profile: Update your information

πŸ”§ Technology Stack

  • Language: Java 8+
  • GUI: Java Swing
  • Database: MySQL (via XAMPP)
  • JDBC Driver: MySQL Connector/J 8.0.33
  • Images: Unsplash (network images)

πŸ“ Sample Products

The system includes 3 default products:

  1. Hammer - $25.99 (50 in stock)
  2. Screwdriver Set - $35.50 (30 in stock)
  3. Power Drill - $89.99 (20 in stock)

⚠️ Troubleshooting

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

πŸš€ Future Enhancements

  • 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

πŸ“„ License

This project is for educational purposes.

πŸ‘¨β€πŸ’» Author

Hardware Store Management System - Java Project

About

A complete Java Swing desktop application for managing hardware products and inventory with secure MySQL database integration

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors