-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
117 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
out/ | ||
.vscode/ | ||
.vscode/ | ||
build/ | ||
dump/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
REM Run the JAR file | ||
java -jar FastNoteApp.jar |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
# A simple notepad application using java swing | ||
|
||
## Features | ||
|
||
1. Word Wraping | ||
2. Open file | ||
4. Read file | ||
5. Save file | ||
6. 3_Theme | ||
3. Read file | ||
4. Save file | ||
5. 3_Theme | ||
1. LightMode | ||
2. DarkMode | ||
3. HackerTheme | ||
7. Line Number | ||
6. Line Number | ||
|
||
# For Windows, Linux | ||
## Compile | ||
```code | ||
javac -d ./out FastNoteApp.java | ||
javac --release 8 -d ./out FastNoteApp.java | ||
``` | ||
|
||
## Build | ||
```code | ||
jar -cvfm FastNoteApp.jar MANIFEST.MF -C out . | ||
``` | ||
|
||
## Run | ||
```code | ||
java -cp "./out" FastNoteApp | ||
java -jar FastNoteApp.jar | ||
``` | ||
|
||
## package info: | ||
> **Supported by Java1.8 and +** | ||
## Automation Windows | ||
added build process automation. | ||
added run code | ||
``` | ||
!note you must be in the project directory to compile and build | ||
.\build.bat | ||
.\FastNoteApp.bat | ||
``` | ||
> paste the FastNoteApp.jar and FastNoteApp.bat in a directory and add the environment variable to that path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo off | ||
REM compile, build | ||
echo "----------Compiling----------" | ||
javac -d out FastNoteApp.java | ||
if %errorlevel% neq 0 ( | ||
echo "Compile Failed" | ||
) else ( | ||
echo "Compile Successful" | ||
echo "-------Building FastNoteApp.jar-------" | ||
jar cvfm FastNoteApp.jar MANIFEST.MF -C out . | ||
if %errorlevel% neq 0 ( | ||
echo "Build Failed" | ||
) else ( | ||
echo "Compile and Build Successful" | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.geez14.fastnote; | ||
|
||
import javax.swing.text.BadLocationException; | ||
import javax.swing.text.DocumentFilter; | ||
|
||
public class TextFilter { | ||
// DocumentFilter to allow only ASCII characters | ||
static class AsciiOnlyFilter extends DocumentFilter { | ||
@Override | ||
public void insertString(FilterBypass fb, int offset, String string, javax.swing.text.AttributeSet attr) | ||
throws BadLocationException { | ||
if (isAscii(string)) { | ||
super.insertString(fb, offset, string, attr); | ||
} | ||
} | ||
|
||
@Override | ||
public void replace(FilterBypass fb, int offset, int length, String text, javax.swing.text.AttributeSet attrs) | ||
throws BadLocationException { | ||
if (isAscii(text)) { | ||
super.replace(fb, offset, length, text, attrs); | ||
} | ||
} | ||
|
||
@Override | ||
public void remove(FilterBypass fb, int offset, int length) throws BadLocationException { | ||
super.remove(fb, offset, length); | ||
} | ||
|
||
private boolean isAscii(String text) { | ||
for (char c : text.toCharArray()) { | ||
if (c > 127) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} |