Skip to content

siddu-k/todoapp_java

Repository files navigation

Java ToDo App - Task 6

A simple and intuitive To-Do List application built using Java Swing GUI framework.

Features

  • 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

Components Used

Core Java Swing Components

  • 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

Layout Managers

  • BorderLayout: Main window layout
  • FlowLayout: Button and input panels

How to Run

Option 1: Command Line

# Navigate to the ToDoApp directory
cd c:\sid\java\ToDoApp

# Compile the application
javac ToDoApp.java

# Run the application
java ToDoApp

Option 2: IDE (IntelliJ IDEA or Eclipse)

  1. Open the ToDoApp.java file in your IDE
  2. Right-click and select "Run ToDoApp.main()"
  3. Or use the Run button in the toolbar

Application Architecture

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

User Interface Layout

┌─────────────────────────────────────────┐
│ New Task: [_______________] [Add Task]  │ ← North Panel
├─────────────────────────────────────────│
│ ┌─────────────────────────────────────┐ │
│ │ □ Task 1                            │ │
│ │ □ Task 2                            │ │ ← Center Panel (Scrollable)
│ │ □ Task 3                            │ │
│ │                                     │ │
│ └─────────────────────────────────────┘ │
├─────────────────────────────────────────│
│            [Delete Selected]            │ ← South Panel
└─────────────────────────────────────────┘

Key Features & Functionality

1. Adding Tasks

  • 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

2. Deleting Tasks

  • 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

3. User Experience

  • Window is centered on screen startup
  • Resizable window (400x300 default size)
  • Clean, intuitive interface
  • Proper error handling and user feedback

Technical Details

  • 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

Requirements Met

✅ 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

Additional Enhancements

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

Files

  • ToDoApp.java - Main application class with complete functionality
  • README.md - This documentation file

Compatibility

  • Java 8 or higher
  • Works on Windows, macOS, and Linux
  • Compatible with IntelliJ IDEA, Eclipse, NetBeans, and command line compilation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages