A Java-based desktop application for tracking personal expenses with an intuitive GUI. Manage your spending with categories, descriptions, and automatic total calculations, all stored in a local SQLite database.
- Add Expenses - Record expenses with category, amount, and description
- Update & Delete - Edit or remove existing expense entries
- Category Management - Predefined categories (Food, Transport, Entertainment, Utilities, Healthcare, Other)
- Real-Time Totals - Automatic calculation of total expenses
- Data Validation - Input validation to ensure data integrity
- Persistent Storage - SQLite database for reliable data storage
- User-Friendly Interface - Clean Swing-based GUI with table view
- Date Tracking - Automatic date recording for each expense
- Java Development Kit (JDK) 8 or higher
- SQLite JDBC Driver (included in most Java distributions or downloadable)
- Clone the repository
- Open the project in IDE
- Add the SQLite JDBC JAR to the project libraries
- Run
ExpenseTrackerGUI.java
Note: The SQLite database file (expenses.db) will be created automatically in the same directory on first run.
If SQLite JDBC is not included, download it from SQLite JDBC and add to classpath:
- Select a category from the dropdown menu
- Enter the amount (must be greater than $0, max $1,000,000)
- Add an optional description (max 200 characters)
- Click "Add Expense"
- Click on an expense in the table to select it
- Modify the fields in the form
- Click "Update Selected"
- Select an expense from the table
- Click "Delete Selected"
- Confirm the deletion
- Clear Fields - Reset the form without affecting the database
- Total Display - View cumulative expenses at the bottom of the window
Design Patterns
- Singleton Pattern - DatabaseManager ensures single database connection
- MVC-inspired Structure - Separation of data model, business logic, and UI
Project Structure
expense-tracker/
│
├── Expense.java # Data model for expense entries
├── ExpenseTrackerGUI.java # Main GUI and application logic
├── DatabaseManager.java # Database operations and connection
├── ExpenseValidator.java # Input validation logic
├── ValidationException.java # Custom exception for validation errors
└── expenses.db # SQLite database (auto-generated)
- Java Swing - GUI framework for desktop interface
- SQLite - Lightweight embedded database
- JDBC - Database connectivity
- Java Time API - Date handling with LocalDate
expenses table
| Column | Type | Description |
|---|---|---|
| id | INTEGER | Primary key (auto-increment) |
| category | TEXT | Expense category |
| amount | REAL | Expense amount in dollars |
| description | TEXT | Optional expense description |
| date | TEXT | Date in ISO format (YYYY-MM-DD) |
- Category: Cannot be empty
- Amount: Must be numeric, greater than $0, max $1,000,000
- Description: Optional, max 200 characters
- Date range filtering for expense reports
- Export data to CSV/PDF
- Budget tracking and alerts
- Expense charts and visualizations
- Multiple currency support
- Custom category creation
- Search and filter functionality
- Recurring expense templates
- Dark mode theme
Contributions are welcome! Feel free to:
- Report bugs or issues
- Suggest new features
- Submit pull requests
- Improve documentation
Created by Alex | Java Swing Desktop Application