# raheelnaziir/text-editor architecture

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

- Interactive diagram: https://gitdiagram.com/raheelnaziir/text-editor
- Repository: https://github.com/raheelnaziir/text-editor

## Overview

This is a small Swing Notepad-style editor. The workflow starts in the application entry point, opens an editor window, and lets the user edit text, search or format it, and save or open files through disk or the database. Editing capabilities are implemented within one large frame class rather than separate modules. The sampled code shows editor construction, disk saving, database access, search highlighting, and dispatch to save operations; other capabilities are documented in the README but their implementation details were not sampled.

Main entry points: [`src/EditorFrame.java`](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java) (Editor window), [`src/Main.java`](https://github.com/raheelnaziir/text-editor/blob/main/src/Main.java) (Application entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Editor application"]
  node_main["Application entry<br/>[Main.java]"]
  node_frame["Editor window<br/>[EditorFrame.java]"]
end

subgraph group_editing["Text editing"]
  node_text["Text editing<br/>[EditorFrame.java]"]
  node_search["Search highlighting<br/>[EditorFrame.java]"]
  node_format["Formatting controls<br/>[EditorFrame.java]"]
  node_undo["Undo and redo<br/>[EditorFrame.java]"]
end

subgraph group_persistence["File persistence"]
  node_disk["Text files<br/>[EditorFrame.java]"]
  node_database["Saved documents<br/>[EditorFrame.java]"]
end

node_user(("User"))
node_mysql[("MySQL database")]

node_user -->|"launches"| node_main
node_main -->|"creates"| node_frame
node_user -->|"edits text"| node_frame
node_frame -->|"hosts"| node_text
node_frame -->|"searches"| node_search
node_frame -->|"formats"| node_format
node_frame -->|"supports"| node_undo
node_frame -->|"saves or opens"| node_disk
node_frame -->|"saves or opens"| node_database
node_database -->|"connects"| node_mysql

click node_main "https://github.com/raheelnaziir/text-editor/blob/main/src/Main.java"
click node_frame "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_text "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_search "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_format "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_undo "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_disk "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"
click node_database "https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_frame,node_user toneBlue
class node_text,node_search,node_format,node_undo,node_mysql toneAmber
class node_disk,node_database toneMint
```

## Components

### Editor application

- [Application entry](https://github.com/raheelnaziir/text-editor/blob/main/src/Main.java): `src/Main.java`
- [Editor window](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`

### Text editing

- [Text editing](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`
- [Search highlighting](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`
- [Formatting controls](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`
- [Undo and redo](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`

### File persistence

- [Text files](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`
- [Saved documents](https://github.com/raheelnaziir/text-editor/blob/main/src/EditorFrame.java): `src/EditorFrame.java`

### Other components

- **User**
- **MySQL database**

## Connections

- User → Application entry: launches (evidence: `README.md`)
- Application entry → Editor window: creates (evidence: `src/Main.java`)
- User → Editor window: edits text (evidence: `README.md`)
- Editor window → Text editing: hosts (evidence: `src/EditorFrame.java`)
- Editor window → Search highlighting: searches (evidence: `src/EditorFrame.java`)
- Editor window → Formatting controls: formats (evidence: `README.md`)
- Editor window → Undo and redo: supports (evidence: `README.md`)
- Editor window → Text files: saves or opens (evidence: `README.md`)
- Editor window → Saved documents: saves or opens (evidence: `src/EditorFrame.java`)
- Saved documents → MySQL database: connects (evidence: `src/EditorFrame.java`)
