A lightweight Java-based desktop text editor with essential text editing, file management, search and replace, and custom encryption/decryption, all through a simple graphical interface.
- Overview
- Features
- Technology Stack
- Architecture
- Project Structure
- Class Descriptions
- Encryption & Decryption Workflow
- Supported File Types
- Keyboard Shortcuts
- Getting Started
- Application Workflow
- Project Objectives
- Learning Outcomes
- Feature Status
- Known Limitations
- Future Enhancements
- Security Note
- Screenshots
- Contributing
- License
The Notepad Application is a desktop text editor built with Java AWT. It provides a simple, intuitive environment for creating, editing, opening, and saving text-based documents.
Beyond standard editing, it includes Find, Replace, Replace All, and a custom encryption/decryption feature. The project is split into multiple Java classes, with separate components for file operations, dialogs, encryption, decryption, and shared constants. Encrypted files are stored in a custom .mg format.
The project demonstrates practical use of:
- Object-Oriented Programming
- Java AWT GUI development
- Event-driven programming
- File handling and I/O
- Text processing
- Dialog-based user interaction
- Keyboard event handling
- Custom encryption and decryption logic
- Modular application design
A basic text editor built on Java's TextArea component. Users can enter, modify, and manage text directly in the window.
Open and save files using Java's FileDialog. See Supported File Types for the full list.
Create a new Notepad window with the New option.
Save documents with the Save option. For new documents, a save dialog appears and .mg is used as the default extension.
Basic clipboard operations. The selected text is held temporarily inside the application.
Search for specific text in the document. Matches are highlighted, and the search can continue from the previous position.
A dedicated Replace dialog with:
| Control | Purpose |
|---|---|
| Find What | Text to search for |
| Replace With | Replacement text |
| Find Next | Jump to the next occurrence |
| Replace | Replace the current selection |
| Replace All | Replace every occurrence |
A custom mechanism implemented in the Encrypt class. A random key is generated for each encryption, and key information is embedded at the beginning of the text before the content is transformed.
The Decrypt class reconstructs the key from the encrypted content and recovers the original text. Files in the .mg format are automatically decrypted when opened.
Custom alert dialogs display messages for:
- Empty Find field
- Text not found
- Unsupported file types
- Other user interaction errors
| Technology | Purpose |
|---|---|
| Java | Core programming language |
| Java AWT | Graphical user interface |
| Java I/O | File reading and writing |
| Java Event Handling | User interaction and application events |
| Object-Oriented Programming | Application structure and modular design |
Each class is responsible for a specific part of the system.
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Notepad.java โ
โ Main Application โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ FileOperationsโ โ FindDialogBox โ โReplaceDialogBoxโ
โโโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ
โโโโโโดโโโโโโ
โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โ Encrypt โ โ Decrypt โ
โโโโโโโโโโโโ โโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ
โ AlertDialogBox โ
โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ
โ Constants โ
โโโโโโโโโโโโโโโโโโโโ
| Module | Responsibility |
|---|---|
Notepad |
Main application and GUI |
FileOperations |
File reading and writing |
FindDialogBox |
Text searching |
ReplaceDialogBox |
Find and replace |
Encrypt |
Text encryption |
Decrypt |
Text decryption |
AlertDialogBox |
Error and alert messages |
Constants |
Shared encryption constants |
notepad/
โ
โโโ Notepad.java
โโโ FileOperations.java
โโโ FindDialogBox.java
โโโ ReplaceDialogBox.java
โโโ Encrypt.java
โโโ Decrypt.java
โโโ AlertDialogBox.java
โโโ Constants.java
โโโ .gitignore
โโโ README.md
The main class of the application; it extends Java's Frame class. It is responsible for:
- Creating the main window, text area, and menu bar
- Handling menu actions
- Opening and saving files
- Creating new Notepad windows
- Cut, copy, and paste operations
- Invoking the Find and Replace dialogs
- Handling keyboard shortcuts
- Managing supported file extensions
The application starts from:
public static void main(String[] args) {
new Notepad();
}Handles file-related operations:
- Opening files and reading their content
- Saving documents
- Processing encrypted
.mgfiles - Calling the encryption and decryption classes
Uses Java I/O classes such as FileInputStream, FileOutputStream, BufferedReader, DataInputStream, and DataOutputStream.
Implements the Find dialog. It lets the user:
- Enter search text
- Find the next occurrence
- See an error if the search field is empty
- See an error if the text is not found
The dialog communicates with the main Notepad class to perform the search.
Implements the Replace dialog with three operations:
- Find Next: searches for the next occurrence of the specified text
- Replace: replaces the currently selected occurrence
- Replace All: replaces all matching occurrences in the document
Implements the custom encryption mechanism. When an Encrypt object is created, it:
- Generates a random encryption key
- Converts the key into binary representation
- Embeds key information into the text
- Transforms characters using the generated key
- Produces the encrypted text, which is then stored in the file
Reverses the encryption process. It:
- Extracts the embedded key information
- Reconstructs the encryption key
- Removes the embedded metadata
- Applies the reverse transformation
- Returns the decrypted text
Primarily used when opening .mg files.
A reusable dialog for displaying messages and errors, such as empty search input, text not found, and unsupported files.
An interface holding the constants used by encryption and decryption. It defines the special characters used to embed and recover encryption information.
The application uses a custom character-based encryption mechanism.
User enters text
โ
Generate random encryption key
โ
Convert key to binary
โ
Embed key information into text
โ
Transform characters using key
โ
Generate encrypted content
โ
Save encrypted content
Open encrypted .mg file
โ
Read encrypted content
โ
Extract embedded key information
โ
Reconstruct encryption key
โ
Reverse character transformation
โ
Recover original text
โ
Display text in editor
Note: The encryption mechanism is a custom educational implementation and is not a replacement for modern, industry-standard cryptographic algorithms.
| Extension | Description |
|---|---|
.txt |
Plain text |
.mg |
Encrypted file format used by this application |
.java |
Java source |
.c |
C source |
.cpp |
C++ source |
.py |
Python source |
.php |
PHP source |
.js |
JavaScript source |
.html |
HTML |
.css |
CSS |
.xml |
XML |
.log |
Log files |
| Shortcut | Action |
|---|---|
Ctrl + N |
Create a new Notepad window |
Ctrl + O |
Open a file |
Ctrl + S |
Save the current file |
Ctrl + F |
Open the Find dialog |
Ctrl + H |
Open the Replace dialog |
Ctrl + W |
Exit the application |
- Java Development Kit (JDK)
- Java compiler (
javac) - Java Runtime Environment
- A Java-compatible IDE or terminal
Verify your installation:
java -version
javac -version1. Clone the repository
git clone https://github.com/YOUR-USERNAME/notepad-project.gitReplace
YOUR-USERNAMEwith your GitHub username.
2. Navigate to the project directory
cd notepad-project3. Compile the source files
javac *.java4. Run the application
java NotepadThe Notepad window should open.
Open the project directory in any of the following and run Notepad.java using its main() method:
- IntelliJ IDEA
- Eclipse
- NetBeans
- Visual Studio Code with Java extensions
Launch Application
โ
Create / Open Document
โ
Write or Edit Content
โ
Find / Replace Text (Optional)
โ
Save Document
โ
Encrypted Content Stored
โ
Reopen File
โ
Content Decrypted
โ
Continue Editing
- Develop a functional desktop text editor using Java
- Understand Java AWT-based GUI development
- Implement event-driven programming
- Implement file handling using Java I/O
- Provide text search and replacement functionality
- Implement keyboard shortcuts for common operations
- Understand modular software design
- Implement a custom encryption and decryption mechanism
- Provide a simple and interactive user interface
- Gain practical experience building a complete Java desktop application
Building this project helps practically reinforce:
- Java classes and objects
- Inheritance
- Interfaces
- Event listeners
- AWT components
- Layout managers
- Dialog boxes
- File streams
- Buffered file reading
- Character manipulation
- String processing
- Keyboard event handling
- Exception handling
- Modular programming
- Basic encryption concepts
| Feature | Status |
|---|---|
| Text Editing | โ Implemented |
| New Document | โ Implemented |
| Open File | โ Implemented |
| Save File | โ Implemented |
| Cut / Copy / Paste | โ Implemented |
| Find | โ Implemented |
| Replace / Replace All | โ Implemented |
| Keyboard Shortcuts | โ Implemented |
| Custom Encryption | โ Implemented |
| Custom Decryption | โ Implemented |
| Multiple Tabs | โ Not implemented |
| Auto Save | โ Not implemented |
| Undo / Redo | โ Not implemented |
| Dark Mode | โ Not implemented |
| Syntax Highlighting | โ Not implemented |
- The UI is based on Java AWT and has a basic visual design.
- No modern text formatting features.
- Clipboard functionality is implemented internally rather than through the system clipboard.
- The encryption mechanism is custom and intended for educational purposes only.
- A machine-specific command path is used to launch a new window, which may need updating on another system.
- Advanced document management (tabs, auto-save, undo/redo) is not included.
User Interface
- Modern graphical interface, dark mode, and custom themes
- Adjustable font size and font family
- Text formatting options
- Improved responsive layout
Editing
- Undo and redo
- Word count and character count
- Line numbering
- Auto-indentation
- Select All
- Improved (system) clipboard support
File Management
- Recent files
- Auto-save and file recovery
- Multiple document tabs
- Drag-and-drop file opening
- Better file format detection
Security
- Replace the custom scheme with established standards such as AES, RSA, and PBKDF2
- Secure password-based key derivation
Additional Features
- Print documents
- Export to PDF
- Syntax highlighting
- Custom keyboard shortcuts
- Preferences/settings panel
- Search history
The encryption functionality in this project demonstrates a custom encryption concept for educational purposes only. It should not be used to protect sensitive or confidential information. For real-world applications, use well-established, thoroughly reviewed cryptographic algorithms and libraries.
Add screenshots to a
screenshots/folder in the repository and reference them below.
Contributions and improvements are welcome.
- Fork the repository.
- Create a new branch:
git checkout -b feature/new-feature
- Make your changes.
- Commit your changes:
git commit -m "Add new feature" - Push the branch:
git push origin feature/new-feature
- Open a Pull Request.
This project is intended for educational and learning purposes.

