A comprehensive Java + JavaFX application for managing shop operations including products, categories, customers, orders, and payments.
- Create, edit, and delete product categories
- Active/inactive status management
- Category-based product organization
- Complete product information management
- Stock quantity tracking
- Low stock alerts
- SKU-based product identification
- Category association
- Price and cost management
- Customer registration and profile management
- Contact information storage
- Address management
- Customer order history
- Create and manage customer orders
- Order status tracking (Pending, Confirmed, Processing, Shipped, Delivered, Cancelled, Refunded)
- Order item management
- Automatic total calculations
- Tax and discount handling
- Multiple payment methods (Cash, Credit Card, Debit Card, Bank Transfer, PayPal, etc.)
- Payment status tracking
- Transaction reference management
- Refund processing
- Overview of key metrics
- Total products, customers, orders, and revenue
- Quick access to all modules
- Java 17 - Core programming language
- JavaFX 19 - Desktop GUI framework
- Maven - Build tool and dependency management
- H2 Database - Embedded database for data storage
- FXML - UI layout definition
src/
βββ main/
β βββ java/
β β βββ com/shop/
β β β βββ App.java # Main application class
β β β βββ controller/ # JavaFX controllers
β β β β βββ MainController.java
β β β β βββ DashboardController.java
β β β β βββ CategoryController.java
β β β β βββ ProductController.java
β β β β βββ CustomerController.java
β β β β βββ OrderController.java
β β β β βββ PaymentController.java
β β β βββ model/ # Data models
β β β β βββ Category.java
β β β β βββ Product.java
β β β β βββ Customer.java
β β β β βββ Order.java
β β β β βββ OrderItem.java
β β β β βββ Payment.java
β β β βββ dao/ # Data Access Objects
β β β β βββ CategoryDAO.java
β β β β βββ ProductDAO.java
β β β β βββ CustomerDAO.java
β β β β βββ OrderDAO.java
β β β β βββ PaymentDAO.java
β β β βββ database/ # Database configuration
β β β βββ DatabaseConfig.java
β β βββ module-info.java # Java module definition
β βββ resources/
β βββ fxml/ # FXML view files
β βββ MainView.fxml
β βββ DashboardView.fxml
β βββ CategoryView.fxml
β βββ ProductView.fxml
β βββ CustomerView.fxml
β βββ OrderView.fxml
β βββ PaymentView.fxml
βββ pom.xml # Maven configuration
βββ build.bat # Windows build script
βββ run.bat # Windows run script
- Java Development Kit (JDK) 17 or later
- Apache Maven 3.6 or later
- Windows (for the provided batch scripts)
-
Clone or download the project to your local machine
-
Navigate to the project directory:
cd "c:\Users\User\Desktop\java project"
-
Build the project:
build.bat
-
Run the application:
run.bat
If you prefer using Maven directly:
-
Clean and compile:
mvn clean compile
-
Run the application:
mvn javafx:run
-
Package the application:
mvn clean package
The application uses an embedded H2 database that will be automatically created in the database/ folder when you first run the application. The database includes the following tables:
categories- Product categoriescustomers- Customer informationproducts- Product inventoryorders- Customer ordersorder_items- Individual items within orderspayments- Payment transactions
- Run the application using
run.batormvn javafx:run - The main window will open with a dashboard showing key metrics
- Use the sidebar navigation to access different modules
- Click on "π·οΈ Categories" in the sidebar
- Fill in the category information form
- Click "Save" to create a new category
- Select a category from the table to edit or delete it
- Click on "π¦ Products" in the sidebar
- Fill in the product information form
- Select a category from the dropdown
- Set pricing and stock information
- Click "Save" to create a new product
- Click on "π₯ Customers" in the sidebar
- Enter customer details including contact information
- Add address details for shipping
- Click "Save" to register the customer
- Click on "π Orders" in the sidebar
- Select a customer
- Add products to the order
- Set quantities and verify pricing
- Apply any discounts or taxes
- Save the order
- Click on "π³ Payments" in the sidebar
- Select an order to process payment for
- Choose payment method
- Enter payment details
- Mark payment as completed
- Models: Add new entity classes in
com.shop.model - DAOs: Create corresponding DAO classes in
com.shop.dao - Controllers: Implement JavaFX controllers in
com.shop.controller - Views: Design FXML layouts in
src/main/resources/fxml - Database: Update
DatabaseConfig.javato include new tables
When modifying the database schema:
- Update the table creation SQL in
DatabaseConfig.java - Delete the existing
database/folder to recreate the database - Update corresponding model and DAO classes
The project structure supports JUnit testing. Add test classes in src/test/java/ following the same package structure.
- JavaFX Runtime Error: Ensure JavaFX modules are properly configured in your IDE
- Database Connection Error: Check if the
database/folder has write permissions - Maven Build Error: Verify Java 17+ and Maven 3.6+ are installed
- Application logs are displayed in the console
- Database files are stored in the
database/folder - Enable H2 Console by modifying the database URL in
DatabaseConfig.java
This project is provided as an educational example for Java + JavaFX development.
Feel free to fork this project and submit pull requests for improvements or bug fixes.