A simple and intuitive To-Do List application built using Java Swing GUI framework.
- Add Tasks: Enter new tasks using the text field and click "Add Task" or press Enter
- Delete Tasks: Select a task from the list and click "Delete Selected" to remove it
- Task Management: View all tasks in a scrollable list interface
- User-Friendly: Confirmation dialogs for deletion and validation for empty tasks
- JFrame: Main application window
- JTextField: Input field for new tasks (20 characters wide)
- JButton: "Add Task" and "Delete Selected" buttons
- JList: Display list of tasks with single selection mode
- JScrollPane: Scrollable container for the task list
- JPanel: Layout containers for organizing components
- BorderLayout: Main window layout
- FlowLayout: Button and input panels
# Navigate to the ToDoApp directory
cd c:\sid\java\ToDoApp
# Compile the application
javac ToDoApp.java
# Run the application
java ToDoApp
- Open the
ToDoApp.java
file in your IDE - Right-click and select "Run ToDoApp.main()"
- Or use the Run button in the toolbar
ToDoApp (JFrame)
├── initializeComponents() - Set up GUI components
├── setupLayout() - Arrange components using layouts
├── setupEventListeners() - Handle button clicks and key events
├── setupWindow() - Configure window properties
├── addTask() - Add new task to the list
├── deleteSelectedTask() - Remove selected task with confirmation
└── main() - Entry point and GUI initialization
┌─────────────────────────────────────────┐
│ New Task: [_______________] [Add Task] │ ← North Panel
├─────────────────────────────────────────│
│ ┌─────────────────────────────────────┐ │
│ │ □ Task 1 │ │
│ │ □ Task 2 │ │ ← Center Panel (Scrollable)
│ │ □ Task 3 │ │
│ │ │ │
│ └─────────────────────────────────────┘ │
├─────────────────────────────────────────│
│ [Delete Selected] │ ← South Panel
└─────────────────────────────────────────┘
- Type task description in the text field
- Click "Add Task" button or press Enter
- Input field clears automatically after adding
- Focus returns to input field for quick entry
- Shows warning if trying to add empty task
- Select task from the list by clicking on it
- Click "Delete Selected" button
- Confirmation dialog appears before deletion
- Shows warning if no task is selected
- Window is centered on screen startup
- Resizable window (400x300 default size)
- Clean, intuitive interface
- Proper error handling and user feedback
- Language: Java
- GUI Framework: Swing (built-in)
- Threading: Uses SwingUtilities.invokeLater() for thread safety
- Design Pattern: Event-driven programming with ActionListeners
- Data Structure: DefaultListModel for dynamic list management
✅ Java GUI application using Swing
✅ JFrame as main window container
✅ JButton for Add/Delete functionality
✅ JTextField for task input
✅ Add tasks using button interaction
✅ Delete tasks using button interaction
✅ Professional and user-friendly interface
Beyond the basic requirements, this application includes:
- Input validation and error messages
- Confirmation dialogs for destructive actions
- Keyboard shortcuts (Enter to add tasks)
- Scrollable task list for handling many items
- Professional code documentation and structure
ToDoApp.java
- Main application class with complete functionalityREADME.md
- This documentation file
- Java 8 or higher
- Works on Windows, macOS, and Linux
- Compatible with IntelliJ IDEA, Eclipse, NetBeans, and command line compilation