A desktop task management application built with Java Swing and MySQL for organizing and tracking your daily todos.
- Overview
- Features
- Technology Stack
- Prerequisites
- Installation
- Database Setup
- Configuration
- Usage
- Project Structure
- Building the Application
- Contributing
- License
The Todo Application is a Java-based desktop application that helps users manage their tasks efficiently. With an intuitive graphical interface, users can create, update, delete, and filter todos while tracking completion status and timestamps. The application uses MySQL for persistent storage and follows the MVC architectural pattern.
- Create Todos: Add new tasks with title and description
- Update Todos: Modify existing task details and completion status
- Delete Todos: Remove completed or unwanted tasks
- Mark as Complete: Toggle completion status with a checkbox
- Filter by Status: View all tasks, only completed tasks, or pending tasks
- Chronological Ordering: Tasks sorted by creation date (newest first)
- Quick Search: Easy table-based browsing
- Creation Timestamp: Automatically records when each task was created
- Update Timestamp: Tracks when tasks were last modified
- Status Tracking: Visual indication of completed vs pending tasks
- Clean Swing GUI: Intuitive desktop interface
- Table View: All tasks displayed in an organized table
- Form Inputs: Easy-to-use input fields for task details
- Single Row Selection: Select tasks to update or delete
- Status Bar: Helpful hints and instructions
- Language: Java 24
- GUI Framework: Java Swing
- Database: MySQL 8.0.33
- Build Tool: Apache Maven
- Database Driver: MySQL Connector/J 8.0.33
- Architecture: MVC Pattern with DAO Layer
Before running the application, ensure you have the following installed:
-
Java Development Kit (JDK): Version 24 or higher
-
Apache Maven: Version 3.6 or higher
- Download from Maven Official Site
- Verify installation:
mvn -version
-
MySQL Server: Version 8.0 or higher
- Download from MySQL Official Site
- Ensure MySQL service is running
git clone <repository-url>
cd TodoAppMaven will automatically download required dependencies:
mvn clean installOpen MySQL command line or MySQL Workbench and execute:
CREATE DATABASE todo;
USE todo;Execute the following SQL to create the todos table:
CREATE TABLE todos (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
completed BOOLEAN DEFAULT FALSE,
create_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);INSERT INTO todos (title, description, completed) VALUES
('Complete project documentation', 'Write comprehensive README and API docs', FALSE),
('Review pull requests', 'Review and merge pending PRs on GitHub', FALSE),
('Update dependencies', 'Check for security updates and new versions', TRUE),
('Prepare presentation', 'Create slides for team meeting', FALSE),
('Code review meeting', 'Attend weekly code review session', TRUE);Update the database connection settings in src/main/java/com/todo/util/DatabaseUtil.java:
private static final String URL = "jdbc:mysql://localhost:3306/todo?useSSL=true&serverTimezone=UTC";
private static final String USER = "your_mysql_username";
private static final String PASSWORD = "your_mysql_password";Important Security Note: For production use, move credentials to environment variables instead of hardcoding them.
- Create a
.envfile in the project root:
DB_URL=jdbc:mysql://localhost:3306/todo?useSSL=true&serverTimezone=UTC
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password- Add
.envto.gitignoreto prevent committing credentials
mvn exec:java# Build the JAR file
mvn package
# Run the JAR
java -jar target/todo-application-1.0.0.jar- Enter the task title in the "Title" field (required)
- Add a description in the "Description" area (optional)
- Check the "Completed" checkbox if the task is already done
- Click "Add Todo" button
- The new task appears in the table
- All Todos: The table displays all tasks by default
- Filter Options: Use the dropdown at the top to filter:
- All: Show all tasks
- Completed: Show only completed tasks
- Pending: Show only pending tasks
- Click on a todo row in the table to select it
- The task details will populate the input fields
- Modify the title, description, or completion status
- Click "Update Todo" button
- Confirm the update in the success dialog
- Click on a todo row in the table to select it
- Click "Delete Todo" button
- Confirm the deletion in the success dialog
- The task is removed from the table
- Click "Refresh Todo" to reload all tasks from the database
- Resets the filter to show all tasks
- Clears the input form
- Use arrow keys to navigate through the table
- Tab to move between input fields
- Enter to submit forms (when focused on buttons)
TodoApp/
├── pom.xml # Maven configuration
├── README.md # This file
├── .gitignore # Git ignore rules
├── src/
│ └── main/
│ └── java/
│ └── com/
│ └── todo/
│ ├── Main.java # Application entry point
│ ├── dao/
│ │ └── TodoDao.java # Data Access Object
│ ├── gui/
│ │ └── TodoAppGUI.java # Swing GUI
│ ├── model/
│ │ └── Todo.java # Todo entity model
│ └── util/
│ └── DatabaseUtil.java # Database utility
└── target/ # Compiled output (generated)
# Compile the project
mvn compile
# Run tests (if available)
mvn test
# Package as JAR
mvn packageThe project uses maven-shade-plugin to create an executable JAR with all dependencies:
mvn clean packageThe executable JAR will be created at: target/todo-application-1.0.0.jar
java -jar target/todo-application-1.0.0.jarDatabase Connection Failed
- Ensure MySQL server is running:
sudo service mysql start(Linux) or check Services on Windows - Verify database credentials in
DatabaseUtil.java - Check if
tododatabase exists:SHOW DATABASES; - Confirm port 3306 is accessible
JDBC Driver Not Found
- Run
mvn clean installto download dependencies - Verify MySQL Connector is in
pom.xml - Check Maven repository cache:
~/.m2/repository
Application Won't Start
- Check Java version:
java -version(must be 24+) - Verify Maven build completed successfully
- Check console for error messages
- Review database connection logs
Table Not Found Error
- Ensure
todostable is created in the database - Run the SQL schema provided in Database Setup
- Verify you're connected to the correct database
GUI Not Displaying Properly
- Update graphics drivers
- Try running with different look and feel
- Check display scaling settings
Main.java
- Entry point of the application
- Initializes database connection
- Sets system look-and-feel
- Launches the GUI
Todo.java (Model)
- Entity class representing a todo item
- Fields: id, title, description, completed, create_at, update_at
- Includes validation and business logic
TodoDao.java (Data Access Layer)
- Database operations for todos
- Methods: create, read, update, delete
- Filtering by completion status
- Prepared statements for SQL injection prevention
TodoAppGUI.java (View/Controller)
- Swing-based user interface
- Event handling for user actions
- Table display with filtering
- Form inputs and validation
DatabaseUtil.java (Utility)
- Database connection management
- JDBC driver initialization
- Connection pooling support (future enhancement)
Contributions are welcome. To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test thoroughly
- Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Create a Pull Request
- Follow Java naming conventions
- Use meaningful variable and method names
- Add JavaDoc comments for public methods
- Keep methods focused and concise
- Use proper exception handling
- Write unit tests for new features
- Add priority levels (High, Medium, Low)
- Implement due dates with calendar picker
- Add categories/tags for better organization
- Create recurring tasks functionality
- Implement search and advanced filtering
- Add data export (CSV, JSON, PDF)
- Include task statistics and analytics dashboard
- Multi-user support with authentication
- Dark mode theme option
- Notification system for due tasks
- Drag-and-drop reordering
- Subtasks/checklist support
This project is open source and available under the MIT License.
For issues, questions, or suggestions:
- Open an issue on the GitHub repository
- Contact the maintainer
- Built with Java Swing
- Database powered by MySQL
- Build automation with Apache Maven
Last Updated: January 19, 2026
