A comprehensive JavaFX-based GUI application for managing inventory at an Internet Café. The system provides a complete solution for item management, dealer selection, and data persistence using object-oriented programming principles. Built with Java 18 and JavaFX, featuring a modern user interface with robust validation and testing.
- ✅ Add Item Details - Add items with validation (Code, Name, Brand, Price, Quantity, Category, Date, Image)
- ✅ Delete Item Details - User-friendly item deletion mechanism
- ✅ Update Item Details - Modify existing item information
- ✅ View Items - Display items sorted by category with thumbnails and total cost calculation
- ✅ Save to File - Persistent storage using serialization (
.serfiles) - ✅ Random Dealer Selection - Select 4 dealers randomly from a text file
- ✅ Dealer Management - Display selected dealers sorted by location (custom sorting algorithm)
- ✅ Dealer Items Display - Show items associated with selected dealers
- ✅ Resume Capability - Load previously saved data on application startup
- Custom Sorting Algorithm - Implemented without using Java's built-in sorting methods
- Input Validation - Comprehensive validation for all user inputs
- Exception Handling - Robust error handling throughout the application
- JUnit Testing - Complete test suite covering validation and functionality
- OOP Principles - Encapsulation, Inheritance, and proper class design
- Language: Java 18
- Framework: JavaFX 18.0.2
- Build Tool: Maven
- Testing: JUnit 5.9.2
- UI Design: FXML with CSS styling
- Data Persistence: Java Serialization
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── com/example/cw_test_1601/
│ │ │ │ ├── Application.java # Main entry point
│ │ │ │ ├── Controller.java # Main controller for navigation
│ │ │ │ ├── Items.java # Item entity class
│ │ │ │ ├── Dealer.java # Dealer entity class
│ │ │ │ ├── Storage.java # Data storage utilities
│ │ │ │ ├── AID.java # Add Item Details controller
│ │ │ │ ├── DID.java # Delete Item Details controller
│ │ │ │ ├── UID.java, UID2.java # Update Item Details controllers
│ │ │ │ ├── VID.java # View Items controller
│ │ │ │ ├── SDD.java # Select Dealer Details controller
│ │ │ │ ├── VRL.java # View Random Dealers controller
│ │ │ │ ├── LDI1.java, LDI2.java # Load Dealer Items controllers
│ │ │ │ ├── Available.java # Available items controller
│ │ │ │ ├── AvailableItems.java # Available items model
│ │ │ │ ├── DealerItems.java # Dealer items model
│ │ │ │ ├── ImageThumbnail.java # Image handling utilities
│ │ │ │ └── [Other utility classes]
│ │ │ └── module-info.java
│ │ └── resources/
│ │ └── com/example/cw_test_1601/
│ │ ├── *.fxml # FXML UI layouts
│ │ ├── Application.css # Stylesheet
│ │ └── Icons/ # Application icons
│ └── Test/
│ └── com/example/cw_test_1601/
│ ├── InputsTest.java # Input validation tests
│ └── LoginTest.java # Login functionality tests
├── Test/ # Test validators and utilities
├── Images/ # Sample item images
├── data/ # Data files (dealers, serialized data)
├── pom.xml # Maven configuration
└── README.md # This file
- Java Development Kit (JDK) 18 or higher
- Maven 3.6+ (or use included Maven Wrapper)
- IDE with JavaFX support (IntelliJ IDEA, Eclipse, VS Code)
-
Clone the repository
git clone <repository-url> cd <repository-name>
-
Build the project
mvn clean compile
Or using Maven Wrapper:
./mvnw clean compile
-
Run the application
mvn javafx:run
Or using Maven Wrapper:
./mvnw javafx:run
- Username:
The Boss - Password:
TheBoss1970
Run the JUnit test suite:
mvn testThe test suite includes:
- Input validation tests (Item Code, Name, Brand, Price, Quantity, Category, Date, Image)
- Login functionality tests
- Edge case handling
- Login → Authenticate with credentials
- Home Screen → Access main menu with all features
- Item Management → Add, Update, Delete, View items
- Dealer Selection → Randomly select 4 dealers
- Dealer View → View selected dealers sorted by location
- Dealer Items → Display items for selected dealers
- Data Persistence → Save/load data automatically
- Encapsulation: All entity classes (Items, Dealer) use private fields with getters
- Inheritance: Controller classes extend base Storage class
- Separation of Concerns: Clear separation between UI (FXML), Controllers, and Models
- Represents an inventory item with all required attributes
- Immutable design with final fields
- Includes total cost calculation
- Represents a dealer with name, telephone, and location
- Used for random selection and sorting
- Base class for data persistence operations
- Handles serialization/deserialization
- Manages file I/O operations
Each dealer file ([Name].txt) contains:
[Name], [Telephone], [Location]
[Item Name], [Brand], [Price], [Quantity]
...
Saved Details.ser- Contains all item data in serialized format- Automatically loaded on application startup
- Updated when items are added, modified, or deleted
- Modern JavaFX Interface - Clean and intuitive design
- Form Validation - Real-time input validation with error messages
- Image Support - Thumbnail display for items
- Responsive Layout - Fixed-size windows optimized for functionality
- Icon Integration - Custom icons for better UX
The application implements strict validation:
- Item Code: 3-digit numeric format (e.g., "001")
- Item Name: Max 20 characters, alphanumeric
- Brand: Max 20 characters, alphanumeric
- Price: Positive decimal number
- Quantity: Positive integer
- Category: Max 20 characters
- Date: Valid date format, not in future
- Image: Valid image file path (.jpg, .jpeg, .png)