# heyubayed/notepad architecture

> Architecture diagram of the GitHub repository heyubayed/notepad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/heyubayed/notepad
- Repository: https://github.com/heyubayed/notepad

## Overview

##### Project type and purpose
- This is a desktop GUI application written in Java (Java Swing).
- Purpose: a simple text editor (“Notepad”) that supports creating/opening/saving `.txt` files, toggling light/dark theme, and adjusting font size.

##### File structure
Top-level:
- bin/notepad – compiled launcher or main class file
- src/notepad/Notepad.java – the main Swing UI and core logic source

Indicators:
- No backend server or database—file I/O goes directly to the local file system
- All code runs in a single process (desktop app)

##### README for additional insights
- Confirms the feature set (theme management, font adjustment, basic file handling)
- Reinforces the use of Swing for GUI

##### Elements
- Clear labels: “Swing UI”, “File Manager”, “Theme Manager”, “Font Manager”, “Resource Loader”, “Local File System”
– From UI to each manager component
– From File Manager to Local File System
– From Resource Loader to UI

##### Detailed breakdown
1. Swing UI (Notepad.java)
- Menus: File (New/Open/Save/Exit); View (Theme toggle, Font size selector)
- TextArea: main editing component
2. File Manager
- Methods: openFile(path), saveFile(path, contents)
- Handles exceptions, encoding
3. Theme Manager
- Maintains current theme state
- Applies Light/Dark LookAndFeel via UIManager.setLookAndFeel()
4. Font Manager
- Stores current font size
- Applies size to JTextArea
5. Resource Loader
6. Local File System

Putting it all together:

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Notepad Application (Java Swing)"
        UI["Swing UI"]:::ui
        File["File Manager"]:::logic
        Theme["Theme Manager"]:::logic
        Font["Font Manager"]:::logic
        Resource["Resource Loader"]:::resource
    end
    FileSystem["Local File System"]:::external

    UI -->|"opens/saves files"| File
    File -->|"read/write .txt"| FileSystem
    UI -->|"toggle theme"| Theme
    UI -->|"adjust font size"| Font
    Resource -->|"provides icons"| UI

    click UI "https://github.com/heyubayed/notepad/blob/main/Notepad/src/notepad/Notepad.java"
    click File "https://github.com/heyubayed/notepad/blob/main/Notepad/src/notepad/Notepad.java"
    click Theme "https://github.com/heyubayed/notepad/blob/main/Notepad/src/notepad/Notepad.java"
    click Font "https://github.com/heyubayed/notepad/blob/main/Notepad/src/notepad/Notepad.java"
    click Resource "https://github.com/heyubayed/notepad/tree/main/Notepad/src/icon"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef resource fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef external fill:#FFB6C1,stroke:#FF0000,stroke-width:2px,stroke-dasharray:5 5;
```
