1- # Simple Text Editor (JavaFX)
1+ <p align =" center " >
2+ <img src =" https://img.shields.io/badge/Simple%20Text%20Editor-JavaFX%20App-blueviolet?style=for-the-badge&logo=java&logoColor=white " alt =" Simple Text Editor Banner " />
3+ </p >
4+
5+ <h1 align =" center " style =" font-family : ' Fira Code' , ' JetBrains Mono' , ' Source Code Pro' , monospace ; font-size : 3rem ; color : #3CC2F7 ; letter-spacing : 2px ;" >📝 Simple Text Editor</h1 >
6+ <p align =" center " style =" font-family : ' Segoe UI' , ' Roboto' , ' Arial' , sans-serif ; color : #8383e2 ; font-size : 1.2rem ;" >
7+ <b >A clean, modern JavaFX text editor with dark mode, keyboard shortcuts, and safety features.</b ><br >
8+ <i >by Mandip Amgain</i >
9+ </p >
10+
11+ <p align =" center " >
12+ <img src =" https://img.shields.io/badge/Java-11%2B-green?style=flat-square&logo=java " >
13+ <img src =" https://img.shields.io/badge/JavaFX-19-blue?style=flat-square&logo=openjdk " >
14+ <img src =" https://img.shields.io/badge/Maven-3.8%2B-yellow?style=flat-square&logo=apachemaven " >
15+ </p >
216
3- A lightweight text editor built with ** Java** , ** JavaFX (FXML + CSS)** , and ** Maven** .
4- It supports opening/saving ` .txt ` files, a dark/light theme toggle, and safe prompts to prevent losing unsaved work.
17+ ---
18+
19+ ## 🎬 Preview
520
6- > Built by ** Mandip Amgain** (CSC-285-01 Project #1 )
21+ <!-- Replace the link below with your app demo video/GIF -->
22+ <p align =" center " >
23+ <img src =" YOUR_VIDEO_OR_GIF_LINK_HERE " alt =" App Demo " width =" 600 " style =" border-radius : 16px ; box-shadow : 0 8px 24px #0003 ; animation : fadeIn 1.2s ;" />
24+ </p >
725
826---
927
1028## ✨ Features
1129
12- - ** Open / Save / Save As…** for ` .txt ` files (UTF-8)
13- - ** Unsaved changes (“dirty”) tracking** with a leading ` * ` in the window title
14- - ** Exit protection** : prompts to save changes before exiting or opening another file
15- - ** Dark Mode toggle** (View → Dark Mode) using JavaFX CSS stylesheets
16- - ** Newline-preserving** file I/O (no collapsed lines)
17- - ** Keyboard shortcuts** (cross-platform)
18- - ` Ctrl/Cmd + O ` → Open
19- - ` Ctrl/Cmd + S ` → Save
20- - ` Ctrl/Cmd + Shift + S ` → Save As…
21- - ` Ctrl/Cmd + Q ` → Exit
30+ <div align =" center " >
2231
23- > Shortcuts are defined in FXML; adjust to taste in ` startpage.fxml ` .
32+ | 🌟 | Feature |
33+ | ---| ---------|
34+ | 💾 | Open, Save, Save As… for ` .txt ` files (UTF-8) |
35+ | 🟢 | Unsaved changes tracking with ` * ` in title |
36+ | ��️ | Exit protection (save prompts) |
37+ | 🌑 | Dark/Light Mode toggle |
38+ | 🔄 | Keyboard shortcuts (cross-platform) |
39+ | 📝 | Newline-preserving file I/O |
40+ | ⌨️ | Customizable shortcuts in FXML |
41+
42+ </div >
2443
2544---
2645
27- ## 🖼️ UI at a glance
46+ ## 🖼️ UI Snapshots
47+
48+ <details >
49+ <summary >Show UI</summary >
2850
29- - ** Menu Bar**
30- - ** File** : Open, Save, Save As…, Exit
31- - ** View** : Dark Mode (checkable)
32- - ** Editor** : A resizable ` TextArea ` (wrap enabled)
51+ <!-- Insert screenshots here if available -->
52+ <p align =" center " >
53+ <img src="https://raw.githubusercontent.com/Mandip77/Simple-TextEditor-Java/main/screenshot-light.png" width="45%" alt="Light Mode" style="border-radius: 8px; box-shadow: 0 4px 18px #0002; margin: 0 12px; animation: slideIn 1.2s;"/>
54+ <img src="https://raw.githubusercontent.com/Mandip77/Simple-TextEditor-Java/main/screenshot-dark.png" width="45%" alt="Dark Mode" style="border-radius: 8px; box-shadow: 0 4px 18px #0002; margin: 0 12px; animation: slideIn 1.2s;"/>
55+ </p >
56+ </details >
3357
3458---
3559
36- ## 🧱 Tech Stack
60+ ## 🧑💻 Tech Stack
3761
38- - ** JDK** : 11+ (tested with JDK 21)
39- - ** JavaFX** : 19 (` javafx-controls ` , ` javafx-fxml ` )
40- - ** Maven** : ` javafx-maven-plugin ` for local runs
62+ ``` yaml
63+ Java : 11+ (tested with 21)
64+ JavaFX : 19 (controls, FXML)
65+ Maven : javafx-maven-plugin
66+ Build Tooling : Maven 3.8+
67+ ` ` `
4168
4269---
4370
44- ## 🚀 Getting Started
45-
46- ### Prerequisites
47- - JDK ** 11+** (recommend 17 or 21)
48- - Maven ** 3.8+**
71+ ## 🚀 Quick Start
4972
50- ## Verify:
51- ```
52- java -version
53- mvn -v
54- ```
55-
56- ## Clone
57- ```
58- git clone https://github.com/<your-username>/<your-repo>.git
59- cd <your-repo>
60- ```
61- Run (dev)
62- ```
73+ ` ` ` bash
74+ git clone https://github.com/Mandip77/Simple-TextEditor-Java.git
75+ cd Simple-TextEditor-Java
6376mvn clean javafx:run
64-
6577```
66- ## Build
67-
68- This project is intended to run via the Maven JavaFX plugin during development.
69- If you want a standalone distribution, you can:
7078
71- use jlink to create a runtime image with JavaFX modules, or
79+ Requires: Java 11+ & Maven 3.8+
7280
73- package and run with proper --module-path pointing to JavaFX libraries.
81+ ---
7482
75- (Ask if you want me to add a jlink profile—happy to wire it.)
83+ ## 🗂️ Project Structure
7684
77- ## 📁 Project Structure
85+ <details >
86+ <summary >Expand for details</summary >
7887
7988```
8089src/
8190 main/
8291 java/
8392 edu/bhcc/mandip/
84- App.java # JavaFX application entry point
85- Controller.java # UI logic: open/save, theme, dirty state, exit prompts
93+ App.java
94+ Controller.java
8695 resources/
8796 edu/bhcc/mandip/
88- startpage.fxml # UI layout (MenuBar + TextArea)
89- light.css # Light theme
90- dark.css # Dark theme
97+ startpage.fxml
98+ light.css
99+ dark.css
91100pom.xml
92101```
102+ </details >
93103
94- ## 🔑 Key Files
95- App.java
96-
97- Loads startpage.fxml from the classpath
98-
99- Applies the light theme by default
100-
101- Passes Stage + Scene to the controller via Controller#init(...)
102-
103- Example snippet:
104- ```
105- URL fxml = App.class.getResource("/edu/bhcc/mandip/startpage.fxml");
106- FXMLLoader loader = new FXMLLoader(fxml);
107- Parent root = loader.load();
108- Scene scene = new Scene(root);
109- scene.getStylesheets().add(App.class.getResource("/edu/bhcc/mandip/light.css").toExternalForm());
110- Controller ctrl = loader.getController();
111- ctrl.init(primaryStage, scene);
112-
113- ```
114- ** Controller.java**
115-
116- Implements:
117-
118- - Open/Save/Save As… using FileChooser
119-
120- - Dirty tracking by listening to TextArea text changes
121-
122- - Exit prompts via Alert (Yes / No / Cancel)
123-
124- - Dark Mode toggle swapping the stylesheet between light.css and dark.css
125- (resilient path lookup; won’t crash if CSS is missing)
126-
127- - Updates the window title to show * when there are unsaved edits.
128-
129- ** startpage.fxml**
130-
131- - Declares the layout
132-
133- - Binds menu items to controller handlers (e.g., onAction="#openfile")
134-
135- ** light.css / dark.css**
136-
137- - Proper JavaFX selectors for TextArea, menus, and scene background
104+ ---
138105
139- Example dark theme:
140- ```
141- .root { -fx-background-color: #1e1e1e; -fx-text-fill: #dcdcdc; }
142- .menu-bar { -fx-background-color: #2d2d2d; }
143- .text-area { -fx-control-inner-background: #2d2d2d; -fx-text-inner-color: #dcdcdc; }
144- .text-area .content { -fx-background-color: #2d2d2d; }
145- ```
146- ## 🎹 Shortcuts (default)
106+ ## 🎹 Keyboard Shortcuts
147107
148108| Action | Windows/Linux | macOS |
149109| -------- | ---------------- | --------------- |
@@ -152,59 +112,47 @@ Example dark theme:
152112| Save As… | Ctrl + Shift + S | Cmd + Shift + S |
153113| Exit | Ctrl + Q | Cmd + Q |
154114
155- Configured in FXML (accelerator="Shortcut+O", etc.). “Shortcut” maps to Ctrl on Windows/Linux and Cmd on macOS.
156-
157- ## 🧰 Troubleshooting
158- ** “Location is not set” / FXML not found**
159-
160- - Ensure startpage.fxml lives under:
161- ```
162- src/main/resources/edu/bhcc/mandip/startpage.fxml
163-
164-
165- ```
166- - After building, it should exist at:
167-
168- ```
169- target/classes/edu/bhcc/mandip/startpage.fxml
170-
171- ```
172- - Dark Mode toggle does nothing or crashes
115+ ---
173116
174- - Confirm light.css and dark.css are in resources (same package path as FXML), e.g.:
175- ```
176- src/main/resources/edu/bhcc/mandip/dark.css
177- src/main/resources/edu/bhcc/mandip/light.css
117+ ## 🛠️ Troubleshooting
178118
179- ```
180- - The controller tries both /edu/bhcc/mandip/< css > and /< css > and logs what it tried.
119+ < details >
120+ < summary >Expand for common issues</ summary >
181121
182- ** macOS: “Timeout while waiting for app reactivation”88**
122+ - FXML/CSS not found? Ensure ` startpage.fxml ` , ` light.css ` , and ` dark.css ` are in ` src/main/resources/edu/bhcc/mandip/ ` .
123+ - Dark mode toggle not working? Confirm CSS files exist as above.
124+ - macOS "Timeout" warnings: benign; ignore.
125+ </details >
183126
184- - This Glass warning is benign and unrelated to FXML/CSS issues.
127+ ---
185128
186- ## 🗺️ Roadmap (nice next features)
129+ ## 🗺️ Roadmap
187130
188131- Status bar (line/column, chars/words)
189-
190- - Find / Replace (Ctrl/Cmd + F / H)
191-
192- - Recent Files menu (persisted via Preferences)
193-
194- - Zoom (Ctrl/Cmd + + / -)
195-
132+ - Find / Replace
133+ - Recent Files menu
134+ - Zoom in/out
196135- Autosave & restore
197136
137+ ---
138+
198139## 🤝 Contributing
199140
200- - PRs and suggestions welcome:
141+ PRs and suggestions welcome!
142+ Fork, branch, and open a PR with description and screenshots/GIFs if UI changes.
201143
202- - Fork the repo
144+ ---
203145
204- - Create a feature branch
146+ ## 📄 License
205147
206- Open a PR with a clear description and screenshots/GIFs if UI changes
148+ MIT (proposed). Please add a LICENSE file.
207149
208- ## 📄 License
150+ ---
151+
152+ <p align =" center " >
153+ <img src =" https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=36BCF7¢ er=true&vCenter=true&width=400&lines=Happy+Editing!+%F0%9F%91%8B " alt =" Animated typing effect " />
154+ </p >
209155
210- Choose a license (e.g., MIT) and add a LICENSE file at the repo root.
156+ <!--
157+ Advanced effects/modern fonts are referenced with inline style tags, but GitHub-flavored Markdown only partially supports these. For the boldest look, consider using custom shields, SVGs, and animated GIFs as shown, and keep screenshots and video up-to-date for maximum visual punch!
158+ -->
0 commit comments