";
+ public static String changelogBackUp = "Version 1.8 14082020:\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " New:\n" +
+ " - Improved Check For Updates function UI.\n" +
+ " - Added Changelog to menubar\n" +
+ " - Added About to menubar\n" +
+ " - Shifted/reorganised settings and menuitems.\n" +
+ " - Improved text completion suggestions and accuracy.\n" +
+ " - Resized settings pane so that button text is fully visible.\n" +
+ " - Tool tip text for assistance on settings.\n" +
+ " - Default font now Noto Sans Regular.\n" +
+ " - Added undo and redo functions to menu and key bindings.\n" +
+ " - binded to:\n" +
+ " Undo: Ctrl-Z\n" +
+ " Redo: Ctrl-R\n" +
+ "\n" +
+ "Version 1.7 23072020:\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " New:\n" +
+ " - Insert phoneme function fully functional.\n" +
+ " - Cleaned up archive and reduced file to 5.27MB\n" +
+ "\n" +
+ " - Fixes (6)\n" +
+ " - 00021 -> Issue where update feature reminds user\n" +
+ " to update even when they are on the current version.\n" +
+ " - 00022 -> Fixed issue where user may exit file they were\n" +
+ " working on without save dialog showing.\n" +
+ " - 00023 -> Fixed issue where text completion is not\n" +
+ " available for jar running SmartEditor.\n" +
+ " - #13 -> Open Recents.\n" +
+ " Open recent function ->\n" +
+ " Save filepaths to settings.txt\n" +
+ " in user default directory.\n" +
+ " - #14 -> Pronunciation Guide\n" +
+ " Pronunciation guide(double click, or phonetic guide text)\n" +
+ " English\n" +
+ " -> Put Phonemes for each word.\n" +
+ " - #16 -> Phoneme Function SPRINT\n" +
+ " - words with 'y' or 'c' show multiple times on\n" +
+ " phoneme dialog.\n" +
+ " - The \"insert phoneme function\" does not work.\n" +
+ "\n" +
+ "\n" +
+ "Version 1.6 19072020:\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " New:\n" +
+ " - Removed compatibility with MacOS Application due to delay in\n" +
+ " fixing issues.\n" +
+ " - Text Completion BETA OUT.\n" +
+ " - Phoneme renderer English version out.\n" +
+ "\n" +
+ " - Fixes (3)\n" +
+ " - 00018 -> Update.jar now is fully compatible with Java Archive\n" +
+ " version. Fixed issue where launcher wouldn't launch\n" +
+ " jar file.\n" +
+ " - 00019 -> SmartEditor archive executable now can save currently\n" +
+ " worked on docs and reopen after user updates with\n" +
+ " update feature.\n" +
+ " - 00020 -> Fixed issue where unsaved text from before clicking\n" +
+ " the update button will not render because of order\n" +
+ " frame was setup in.\n" +
+ "\n" +
+ "\n" +
+ "Version 1.5 13072020:\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " New:\n" +
+ " - Bugs are all imported into database on Github Repository.\n" +
+ " All bug reference numbers will now match accordingly.\n" +
+ " Undocumented bugs will be expressed in five digits(e.g., 00014)\n" +
+ " - Chinese Simplified and Traditional support with Arial Unicode MS.\n" +
+ " - Multilingual font support with Noto Sans & Noto Serif.\n" +
+ " - Default font is now Noto Sans.\n" +
+ " - Nimbus LAF is now the default theme.\n" +
+ " - Text Completion ALPHA OUT.\n" +
+ " - Fixes (8)\n" +
+ " - #4 -> Improve saving function symbol.\n" +
+ " - #6 -> Check For Updates Function\n" +
+ " - After clicking \"Don't Remind Me\", you can still update by\n" +
+ " finding \"Check for updates\" in the menu.\n" +
+ " - #7 -> New Option to Save on Close in settings.\n" +
+ " - #10 -> File Converter\n" +
+ " - #11 -> Text Completion ALPHA OUT.\n" +
+ " - 00015 -> Application path doesn't update in text file\n" +
+ " -> Key to auto update feature.\n" +
+ " - 00016 -> Windows does not have a way to access popup menu.\n" +
+ " Possibly because action performed is for linux.\n" +
+ " Check on \"@Override\" annotation marked on dialog\n" +
+ " (ta.getDocument().addMouseListener.)\n" +
+ " - 00017 -> Save dialog shows even though title shows\n" +
+ " is saved(type hello and delete, then close)\n" +
+ "\n" +
+ "\n" +
+ "Version 1.4 09072020:\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " - New\n" +
+ " - Find Selection option now available.\n" +
+ " - Fixes (4)\n" +
+ " - 00011 -> Fixed Find and Replace issue\n" +
+ " - search always selects length of find word at the\n" +
+ " top of the page\n" +
+ " - 00012 -> Fixed Find and Replace dialog\n" +
+ " to not freeze on deleting a character\n" +
+ " - 00013 -> Fixed \"Find and Replace starts not on first\n" +
+ " occurrence\" issue\n" +
+ " - 00014 -> Fixed \"User changes document but find &\n" +
+ " replace doesn't update.\" issue\n" +
+ "\n" +
+ "\n" +
+ "Version 1.3 07072020:\n" +
+ "\n" +
+ " - Bugs Identified:\n" +
+ " Themes:\n" +
+ " - PGS theme cut, copy and paste functions duplicate copy text\n" +
+ " because PGS has custom paste functions\n" +
+ " Components:\n" +
+ " TextArea:\n" +
+ " - Emoji icons do not work\n" +
+ " TabbedPane:\n" +
+ " - Add shortcuts for navigation(tabbed panes key bindings)\n" +
+ " - Tabbed panes do not open multiple, always only one. (Sprint: 1.5)\n" +
+ " - Saving asterisk shown when unsaved shows file is unsaved\n" +
+ " when user types and deletes or deletes and types same character\n" +
+ " (does not recognize that file didn't really change\n" +
+ " when user typed and deleted words)\n" +
+ " Find & Replace:\n" +
+ " - Find and replace starts not on first occurrence\n" +
+ " - Find and Replace issue\n" +
+ " - File search \"**********\" directs to top of page\n" +
+ " - after searching once, replacing the text freezes program.\n" +
+ "\n" +
+ " - New Features Coming:\n" +
+ " - Method to \"Check for updates\" and update by downloading newer version.\n" +
+ " - Choose whether text should be saved in plain text or rich text\n" +
+ " and how to implement(show and edit) in the window.\n" +
+ " - Option to choose whether file saves automatically before\n" +
+ " program closes.\n" +
+ " - Project structure/path display\n" +
+ " - Tabbed panes for different files. (make sure user can access tabs\n" +
+ " using key bindings command+tab-number)\n" +
+ " - PDF creator.\n" +
+ " - Text completion ~ @textCompletionConcept.java\n" +
+ " - On selecting(double clicking text and two finger clicking)\n" +
+ " check for spelling mistakes in word\n" +
+ " - Highlight/underline words misspelled with checker\n" +
+ " every 5 character changes.\n" +
+ " - Make executable file(.dmg, .exe) for multi-platform use\n" +
+ " without JDK, etc.\n" +
+ " - Run Java and .txt(java) files\n" +
+ " - With compile\n" +
+ " - Without compile\n" +
+ " - Create folder with compile and source\n" +
+ " - Delete previous version\n" +
+ "\n" +
+ " New In This Version:\n" +
+ " - Find and Replace\n" +
+ " - New \"Find Previous\" function added.\n" +
+ " - Rename file feature added to menu (Menu -> Rename).\n" +
+ " - Text completion Scheduled\n" +
+ " - Alpha (Sprint: 2.0)\n" +
+ " - Beta (Sprint: 2.4)\n" +
+ " - Implemented (Sprint: 3.0)\n" +
+ " - Fixes (7)\n" +
+ " - 00004 -> Fixed issue where file opened has a blank first line.\n" +
+ " - 00005 -> Fixed Find and Replace so selection does not repeat\n" +
+ " on single occurrence.\n" +
+ " - 00006 -> Fixed file doesn't save when user opens another\n" +
+ " file in same tab.\n" +
+ " - 00007 -> Setting metal P.L.A.F. as default may give\n" +
+ " ocean theme instead of default-metal.\n" +
+ " - 00008 -> File is erased when user reopens\n" +
+ " same file(unsaved).\n" +
+ " - 00009 -> Issue where user needs to save file(shows file dialog) when opening\n" +
+ " from a blank file.\n" +
+ " - 00010 -> Issue where user saves file after unsaved prompt and\n" +
+ " doesn't see frame(setVisible is false).\n" +
+ "\n" +
+ "\n" +
+ "Version 1.2 04072020:\n" +
+ " - Introducing tabbed panes\n" +
+ " - for multiple windows (Sprint: 1.5)\n" +
+ " - Key bindings support (Sprint: 1.5)\n" +
+ " - Auto-save setting is available\n" +
+ " - MacOS Application available.\n" +
+ "\n" +
+ "Version 1.1 02072020:\n" +
+ " - Find and Replace function fully functional.\n" +
+ " - Option to replace all added.\n" +
+ " - Fixed issue where one occurrence is skipped.\n" +
+ " - Cut, copy and paste functions are now fully functional.\n" +
+ "\n" +
+ "Version 1.0 23062020:\n" +
+ " - Combined all of the following.\n" +
+ "\n" +
+ "Version 0.6 20062020:\n" +
+ " - Bug fixes and patches\n" +
+ " - Theme now can be set as default.\n" +
+ " - Themes instantly take effect when radio button clicked.\n" +
+ " - Themes are shown in a JList format as there are 19 themes.\n" +
+ " - More themes, below shown:\n" +
+ " - Metal (2)\n" +
+ " - Metal\n" +
+ " - Ocean\n" +
+ " - JTattoo (12)\n" +
+ " - Acryl\n" +
+ " - Aero\n" +
+ " - Aluminium\n" +
+ " - Bernstein\n" +
+ " - Fast\n" +
+ " - HiFi\n" +
+ " - McWin\n" +
+ " - Mint\n" +
+ " - Noire\n" +
+ " - Smart\n" +
+ " - Luna (similar to Smart)\n" +
+ " - Texture\n" +
+ " - Original (system)\n" +
+ " - Nimbus\n" +
+ " - Motif\n" +
+ " - PGS (PagoSoft)\n" +
+ "\n" +
+ "Version 0.5 18062020:\n" +
+ " - Cut, copy and paste functions are also available on the menu bar from \"Edit\".\n" +
+ " - Reduced Java Archive size to 2.65MB\n" +
+ " - Bug fixes and patches.\n" +
+ "\n" +
+ "Version 0.4 14062020:\n" +
+ " - Added support for different characters and languages\n" +
+ " - Chinese, English\n" +
+ " - All unicode characters\n" +
+ " - Improved order of menu items for ease of use\n" +
+ " - Key bindings\n" +
+ " - Ctrl-A -> Select All\n" +
+ " - Alt-Del -> Delete word\n" +
+ " - Ctrl-X -> Cut\n" +
+ " - Ctrl-V -> Paste\n" +
+ " - Ctrl-C -> Copy\n" +
+ " - Ctrl-Q -> Quit\n" +
+ " - Ctrl-Z -> Undo\n" +
+ " - Tab -> Insert Tab\n" +
+ "\n" +
+ "Version 0.3 14062020:\n" +
+ " - Save and open settings added and fully functional.\n" +
+ " - Resized settings frame to fit \"set as default\" button.\n" +
+ " - Added scroll bar to frame for better navigation.\n" +
+ " - Fixes (3):\n" +
+ " - 00001 -> Exiting frame is laggy and slow, throws NullPointerException\n" +
+ " - 00002 -> File path issue where jar execution throws Exception\n" +
+ " - 00003 -> Default text file not savable in jar\n" +
+ " - Folder in users' default directory will be created named\n" +
+ " \"SmartEditor\" with default settings file in it.\n" +
+ "\n" +
+ "Version 0.2 13062020:\n" +
+ " - \"Set as Default\" for font family, size and background, foreground colors.\n" +
+ " - Implemented change listeners to see instant effect of changing font, etc.\n" +
+ " - Implemented color palette for choosing colors from Swatches, RGB, CMYK, et al.\n" +
+ " - Renamed frame to say \"Untitled.txt\".\n" +
+ "\n" +
+ "Version 0.1 13062020:\n" +
+ " - Frame set-up\n" +
+ " - JMenuBar with settings, save and open settings.\n" +
+ " - Overall structure of frame Complete\n";
public static String sl = "", s1 = "";
public static JTabbedPane tb;
+ public static DefaultCaret caret = null;
public static void createFrame() throws Exception, Error{
+ caret = (DefaultCaret) ta.getCaret();
+ caret.setBlinkRate(3);
+ caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
m = m.modPow(dd, nn);
tb = new JTabbedPane();
editorFrame.add(tb);
@@ -299,26 +639,34 @@ public void windowDeactivated(WindowEvent e) {
});
JMenuBar mb = new JMenuBar();
+ JMenu smarteditorMenu = new JMenu("SmartEditor");
JMenu menu = new JMenu("Menu");
JMenu edit = new JMenu("Edit");
JMenuItem settings = new JMenuItem("Settings");
JMenuItem theme = new JMenuItem("Theme");
JMenuItem newMenu = new JMenuItem("New");
JMenuItem open = new JMenuItem("Open");
- JMenu openRecent = new JMenu("Open Recent");
+ openRecent = new JMenu("Open Recent");
updateList(openRecent);
JMenuItem save = new JMenuItem("Save");
JMenuItem rename = new JMenuItem("Rename");
- JMenuItem forceCheck = new JMenuItem("Check for Updates");
JMenuItem print = new JMenuItem("Print");
JMenuItem exit = new JMenuItem("Exit");
JMenuItem cut = new JMenuItem("Cut");
JMenuItem copy = new JMenuItem("Copy");
JMenuItem paste = new JMenuItem("Paste");
+ JMenuItem undoMenuItem = new JMenuItem("Undo");
+ JMenuItem redoMenuItem = new JMenuItem("Redo");
+ undoAction = new UndoAction();
+ redoAction = new RedoAction();
JMenuItem findReplace = new JMenuItem("Find & Replace");
+ JMenuItem about = new JMenuItem("About");
+ JMenuItem changeLog = new JMenuItem("What's New");
+ JMenuItem forceCheck = new JMenuItem("Check for Updates");
+
settings.addActionListener(e -> {
- settingFrame.setSize(740, 500);
+ settingFrame.setSize(780, 500);
JPanel addToSettings = new JPanel();
addToSettings.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
@@ -327,8 +675,10 @@ public void windowDeactivated(WindowEvent e) {
c.fill = GridBagConstraints.BOTH;
JLabel fontSize = new JLabel("Font Size");
+ fontSize.setToolTipText("Font Size: How big text will render on the screen.");
SpinnerModel value = new SpinnerNumberModel(SmartEditor.showSizeSpin, 10, 40, 1);
JSpinner spin = new JSpinner(value);
+ spin.setToolTipText("Font Size: How big text will render on the screen.");
spin.addChangeListener(e2 -> {
SmartEditor.showSizeSpin = (int) spin.getValue();
Font f = new Font(SmartEditor.showFontCombo, Font.PLAIN, (int) spin.getValue());
@@ -341,7 +691,9 @@ public void windowDeactivated(WindowEvent e) {
});
JLabel autoSave = new JLabel("Auto Save");
+ autoSave.setToolTipText("Auto Save: Save writing as you type.");
JCheckBox autoSaveT = new JCheckBox();
+ autoSaveT.setToolTipText("Auto Save: Save writing as you type.");
autoSaveT.setSelected(SmartEditor.autoSave);
autoSaveT.addChangeListener(e12 -> {
if(autoSaveT.isSelected()){
@@ -352,7 +704,9 @@ public void windowDeactivated(WindowEvent e) {
});
JLabel saveOnClose = new JLabel("Save On Close");
+ saveOnClose.setToolTipText("Save On Close: Save all writing on exit of SmartEditor.");
JCheckBox saveOnCloseT = new JCheckBox();
+ saveOnCloseT.setToolTipText("Save On Close: Save all writing on exit of SmartEditor.");
saveOnCloseT.setSelected(SmartEditor.saveOnClose);
saveOnCloseT.addChangeListener(e12 -> {
if(saveOnCloseT.isSelected()){
@@ -364,7 +718,6 @@ public void windowDeactivated(WindowEvent e) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
try {
-
InputStream stream = SmartEditor.class.getResourceAsStream("NotoSans" + File.separator + "NotoSans-Light.ttf");
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, stream));
stream = SmartEditor.class.getResourceAsStream("NotoSans" + File.separator + "NotoSans-Regular.ttf");
@@ -377,6 +730,8 @@ public void windowDeactivated(WindowEvent e) {
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, stream));
stream = SmartEditor.class.getResourceAsStream("NotoSerif" + File.separator + "NotoSerif-Thin.ttf");
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, stream));
+ stream = SmartEditor.class.getResourceAsStream("Oxygen" + File.separator + "Oxygen-Light.ttf");
+ ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, stream));
}catch(Exception ex){
ex.printStackTrace();
}
@@ -385,6 +740,8 @@ public void windowDeactivated(WindowEvent e) {
JComboBox box = new JComboBox<>(array);
box.setSelectedItem(SmartEditor.showFontCombo);
JLabel fontFamily = new JLabel("Font");
+ fontFamily.setToolTipText("Font: Choose how your text looks like with different fonts.");
+ box.setToolTipText("Font: Choose how your text looks like with different fonts.");
box.addItemListener(e2 -> {
SmartEditor.showFontCombo = Objects.requireNonNull(box.getSelectedItem()).toString();
Font f = new Font(Objects.requireNonNull(box.getSelectedItem()).toString(), Font.PLAIN, SmartEditor.showSizeSpin);
@@ -397,6 +754,7 @@ public void windowDeactivated(WindowEvent e) {
});
JColorChooser color = new JColorChooser(SmartEditor.showColorPick);
+ color.setToolTipText("Font Color: Choose the color of your text.");
color.getSelectionModel().addChangeListener(e3 -> {
SmartEditor.showColorPick = color.getColor();
Font f = new Font(SmartEditor.showFontCombo, Font.PLAIN, SmartEditor.showSizeSpin);
@@ -409,6 +767,7 @@ public void windowDeactivated(WindowEvent e) {
});
JColorChooser back = new JColorChooser(SmartEditor.showBackPick);
+ back.setToolTipText("Background Color: Choose the color of the background of your text.");
back.getSelectionModel().addChangeListener(e3 -> {
SmartEditor.showBackPick = back.getColor();
Font f = new Font(SmartEditor.showFontCombo, Font.PLAIN, SmartEditor.showSizeSpin);
@@ -454,6 +813,7 @@ public void windowDeactivated(WindowEvent e) {
c.gridwidth = 4;
addToSettings.add(pane, c);
JButton setAsDefault = new JButton("Set as Default");
+ setAsDefault.setToolTipText("Set As Default: All settings will be saved after closing this application");
setAsDefault.addActionListener(e1 -> writeFile());
c.gridy++;
c.gridwidth = 4;
@@ -727,16 +1087,83 @@ public void windowDeactivated(WindowEvent e) {
});
});
- forceCheck.addActionListener(e -> {
- try {
- SmartEditor.remindUpdate = true;
- writeFile();
- SmartEditor.checkForUpdates("manual");
- } catch (IOException ioException) {
- ioException.printStackTrace();
+ about.addActionListener(e -> {
+ JDialog logger = new JDialog();
+ logger.setTitle("About SmartEditor");
+ logger.setSize(700,550);
+ JTextPane ta = new JTextPane();
+ ta.setContentType("text/html");
+ ta.setText(Frame.htmlText);
+ ta.setEditable(false);
+
+ ta.addHyperlinkListener(new HyperlinkListener() {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent event) {
+ if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ String url = event.getURL().toString();
+ try {
+ Desktop.getDesktop().browse(URI.create(url));
+ } catch (IOException ignored) {
+ }
+ }
+ }
+ });
+
+ logger.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosed(WindowEvent e) {
+ logger.setVisible(false);
+ }
+ });
+ logger.getContentPane().add(new JScrollPane(ta));
+ logger.setVisible(true);
+ });
+
+ changeLog.addActionListener(e -> {
+ String line = "";
+ try{
+ URL versionURl = new URL("https://raw.githubusercontent.com/JC-ProgJava/SmartEditor.java/master/docs/changelog.txt");
+ Scanner input = new Scanner(versionURl.openStream());
+ while(input.hasNext()) {
+ line += input.nextLine() + "\n";
+ }
+ }catch(IOException ignored){
+
+ }finally {
+ JTextArea ta = new JTextArea(line.isEmpty() ? Frame.changelogBackUp : line);
+ ta.setEditable(false);
+ JScrollPane scroll = new JScrollPane(ta);
+ JDialog log = new JDialog();
+ log.setTitle("Changelog");
+ log.setSize(430,300);
+ log.add(scroll);
+ log.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosed(WindowEvent e) {
+ log.setVisible(false);
+ }
+ });
+ log.setVisible(true);
}
});
+ forceCheck.addActionListener(e -> {
+ SmartEditor.remindUpdate = true;
+ writeFile();
+ SmartEditor.checkForUpdates("manual");
+ });
+
+ undoMenuItem.addActionListener(e -> {
+ undoMenuItem.setEnabled(undoAction.actionPerformed());
+ });
+
+ redoMenuItem.addActionListener(e -> {
+ redoMenuItem.setEnabled(redoAction.actionPerformed());
+ });
+
+ smarteditorMenu.add(about);
+ smarteditorMenu.add(changeLog);
+ smarteditorMenu.add(forceCheck);
menu.add(settings);
menu.add(theme);
menu.add(newMenu);
@@ -745,12 +1172,14 @@ public void windowDeactivated(WindowEvent e) {
menu.add(save);
menu.add(rename);
menu.add(print);
- menu.add(forceCheck);
menu.add(exit);
edit.add(cut);
edit.add(copy);
edit.add(paste);
+ edit.add(undoMenuItem);
+ edit.add(redoMenuItem);
edit.add(findReplace);
+ mb.add(smarteditorMenu);
mb.add(menu);
mb.add(edit);
editorFrame.add(mb, BorderLayout.PAGE_START);
@@ -767,6 +1196,27 @@ private static void saveFile(String name) {
if (fc.showSaveDialog(null) != JFileChooser.CANCEL_OPTION)
name = fc.getSelectedFile().getAbsolutePath();
saveText = ta.getText();
+ boolean isEmpty = false;
+ boolean filledBlank = false;
+ for(int x = 0; x < SmartEditor.openRecentsFilePath.length - 1; x++){
+ if(SmartEditor.openRecentsFilePath[x].equals(filepath)){
+ break;
+ }else if(SmartEditor.openRecentsFilePath[x].isEmpty() && !filledBlank){
+ SmartEditor.openRecentsFilePath[x] = filepath;
+ filledBlank = true;
+ }else{
+ isEmpty = true;
+ }
+ }
+ if(!isEmpty){
+ int position = SmartEditor.openRecentsFilePath.length - 1;
+ for (int i = (position - 1); i >= 0; i--) {
+ SmartEditor.openRecentsFilePath[i+1] = SmartEditor.openRecentsFilePath[i];
+ }
+ SmartEditor.openRecentsFilePath[0] = filepath;
+ }
+ writeFile();
+ updateList(openRecent);
filepath = fc.getSelectedFile().getAbsolutePath();
SmartEditor.fileDirectoryPath = fc.getSelectedFile().getParent();
}
@@ -846,6 +1296,9 @@ public static void changeTheme(String componentName) throws
case "Texture":
UIManager.setLookAndFeel("com.jtattoo.plaf.texture.TextureLookAndFeel");
break;
+ default:
+ System.err.println("Unexpected theme name input (void changeTheme()).");
+ break;
}
SwingUtilities.updateComponentTreeUI(editorFrame);
SwingUtilities.updateComponentTreeUI(ta);
@@ -878,10 +1331,10 @@ public static void updateList(JMenu openRecent){
if(!ta.getText().equals("")) {
saveFile(filename);
}
- ta.setText("");
File file = new File(lister.getSelectedValue().toString());
- SmartEditor.fileDirectoryPath = file.getParent();
- if(!file.getAbsoluteFile().equals(filepath)) {
+ if(!file.getAbsoluteFile().equals(filepath) && file.exists()) {
+ ta.setText("");
+ SmartEditor.fileDirectoryPath = file.getParent();
filepath = file.getAbsolutePath();
boolean isEmpty = false;
boolean filledBlank = false;
@@ -985,10 +1438,14 @@ public static void makeNewTa(String setText, String title) {
scrollP.setAutoscrolls(true);
scrollP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollP.getViewport().add(ta);
+ ta.setFont(new Font("Sans Serif", Font.PLAIN, SmartEditor.showSizeSpin));
ta.setFont(new Font(SmartEditor.showFontCombo, Font.PLAIN, SmartEditor.showSizeSpin));
ta.setLineWrap(true);
ta.setBackground(SmartEditor.showBackPick);
ta.setForeground(SmartEditor.showColorPick);
+
+ ta.getDocument().addUndoableEditListener(new UndoHandler());
+
ta.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
@@ -1138,11 +1595,7 @@ public void mousePressed(MouseEvent me) {
}
});
- ta.addKeyListener(new KeyListener() {
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
+ ta.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == 17) {
@@ -1155,6 +1608,10 @@ public void keyPressed(KeyEvent e) {
paste();
} else if (e.getKeyCode() == 88) {
cut();
+ }else if(e.getKeyCode() == 90){
+ Frame.undoAction.actionPerformed();
+ }else if(e.getKeyCode() == 82){
+ Frame.redoAction.actionPerformed();
}
}
}
@@ -1167,6 +1624,7 @@ public void keyReleased(KeyEvent e) {
}
}
});
+
if(title.isEmpty()) {
filename = null;
filepath = null;
@@ -1366,7 +1824,7 @@ public static ArrayList getBestChoiceWord(String word) throws URISyntaxE
percent = correct / length;
percent *= 100;
boolean perfect = false;
- if (percent > 80 && compareToThis.charAt(0) == word.charAt(0)) {
+ if (percent >= 80 && compareToThis.charAt(0) == word.charAt(0)) {
if(String.valueOf(percent).equals("100.00")){
perfect = true;
}
@@ -1389,4 +1847,30 @@ public static ArrayList getBestChoiceWord(String word) throws URISyntaxE
}
return listed;
}
-}
\ No newline at end of file
+}
+
+class UndoHandler implements UndoableEditListener {
+ public void undoableEditHappened(UndoableEditEvent e) {
+ Frame.undo.addEdit(e.getEdit());
+ }
+}
+
+class UndoAction extends JMenuItem{
+ public static boolean actionPerformed() {
+ try{
+ Frame.undo.undo();
+ } catch (CannotUndoException ignored) {
+ }
+ return Frame.undo.canUndo();
+ }
+}
+
+class RedoAction extends JMenuItem {
+ public static boolean actionPerformed() {
+ try {
+ Frame.undo.redo();
+ } catch (CannotRedoException ignored) {
+ }
+ return Frame.undo.canRedo();
+ }
+}
diff --git a/SmartEditor.java/src/notepad.png b/SmartEditor.java/src/notepad.png
index 63f7805..5479901 100644
Binary files a/SmartEditor.java/src/notepad.png and b/SmartEditor.java/src/notepad.png differ
diff --git a/docs/SS1.jpg b/docs/SS1.jpg
new file mode 100644
index 0000000..17bb073
Binary files /dev/null and b/docs/SS1.jpg differ
diff --git a/docs/SS1.png b/docs/SS1.png
index 82d895c..694a723 100644
Binary files a/docs/SS1.png and b/docs/SS1.png differ
diff --git a/docs/SmartEditor.dmg b/docs/SmartEditor.dmg
deleted file mode 100644
index 6e2943e..0000000
Binary files a/docs/SmartEditor.dmg and /dev/null differ
diff --git a/docs/SmartEditor.jar b/docs/SmartEditor.jar
deleted file mode 100644
index c64ff09..0000000
Binary files a/docs/SmartEditor.jar and /dev/null differ
diff --git a/docs/changelog.txt b/docs/changelog.txt
new file mode 100644
index 0000000..c019b1b
--- /dev/null
+++ b/docs/changelog.txt
@@ -0,0 +1,266 @@
+Version 1.8 14082020:
+
+ New In This Version:
+ New:
+ - Improved Check For Updates function UI.
+ - Added Changelog to menubar
+ - Added About to menubar
+ - Shifted/reorganised settings and menuitems.
+ - Improved text completion suggestions and accuracy.
+ - Resized settings pane so that button text is fully visible.
+ - Tool tip text for assistance on settings.
+ - Default font now Noto Sans Regular.
+ - Added undo and redo functions to menu and key bindings.
+ - binded to:
+ Undo: Ctrl-Z
+ Redo: Ctrl-R
+
+Version 1.7 23072020:
+
+ New In This Version:
+ New:
+ - Insert phoneme function fully functional.
+ - Cleaned up archive and reduced file to 5.27MB
+
+ - Fixes (6)
+ - 00021 -> Issue where update feature reminds user
+ to update even when they are on the current version.
+ - 00022 -> Fixed issue where user may exit file they were
+ working on without save dialog showing.
+ - 00023 -> Fixed issue where text completion is not
+ available for jar running SmartEditor.
+ - #13 -> Open Recents.
+ Open recent function ->
+ Save filepaths to settings.txt
+ in user default directory.
+ - #14 -> Pronunciation Guide
+ Pronunciation guide(double click, or phonetic guide text)
+ English
+ -> Put Phonemes for each word.
+ - #16 -> Phoneme Function SPRINT
+ - words with 'y' or 'c' show multiple times on
+ phoneme dialog.
+ - The "insert phoneme function" does not work.
+
+
+Version 1.6 19072020:
+
+ New In This Version:
+ New:
+ - Removed compatibility with MacOS Application due to delay in
+ fixing issues.
+ - Text Completion BETA OUT.
+ - Phoneme renderer English version out.
+
+ - Fixes (3)
+ - 00018 -> Update.jar now is fully compatible with Java Archive
+ version. Fixed issue where launcher wouldn't launch
+ jar file.
+ - 00019 -> SmartEditor archive executable now can save currently
+ worked on docs and reopen after user updates with
+ update feature.
+ - 00020 -> Fixed issue where unsaved text from before clicking
+ the update button will not render because of order
+ frame was setup in.
+
+
+Version 1.5 13072020:
+
+ New In This Version:
+ New:
+ - Bugs are all imported into database on Github Repository.
+ All bug reference numbers will now match accordingly.
+ Undocumented bugs will be expressed in five digits(e.g., 00014)
+ - Chinese Simplified and Traditional support with Arial Unicode MS.
+ - Multilingual font support with Noto Sans & Noto Serif.
+ - Default font is now Noto Sans.
+ - Nimbus LAF is now the default theme.
+ - Text Completion ALPHA OUT.
+ - Fixes (8)
+ - #4 -> Improve saving function symbol.
+ - #6 -> Check For Updates Function
+ - After clicking "Don't Remind Me", you can still update by
+ finding "Check for updates" in the menu.
+ - #7 -> New Option to Save on Close in settings.
+ - #10 -> File Converter
+ - #11 -> Text Completion ALPHA OUT.
+ - 00015 -> Application path doesn't update in text file
+ -> Key to auto update feature.
+ - 00016 -> Windows does not have a way to access popup menu.
+ Possibly because action performed is for linux.
+ Check on "@Override" annotation marked on dialog
+ (ta.getDocument().addMouseListener.)
+ - 00017 -> Save dialog shows even though title shows
+ is saved(type hello and delete, then close)
+
+
+Version 1.4 09072020:
+
+ New In This Version:
+ - New
+ - Find Selection option now available.
+ - Fixes (4)
+ - 00011 -> Fixed Find and Replace issue
+ - search always selects length of find word at the
+ top of the page
+ - 00012 -> Fixed Find and Replace dialog
+ to not freeze on deleting a character
+ - 00013 -> Fixed "Find and Replace starts not on first
+ occurrence" issue
+ - 00014 -> Fixed "User changes document but find &
+ replace doesn't update." issue
+
+
+Version 1.3 07072020:
+
+ - Bugs Identified:
+ Themes:
+ - PGS theme cut, copy and paste functions duplicate copy text
+ because PGS has custom paste functions
+ Components:
+ TextArea:
+ - Emoji icons do not work
+ TabbedPane:
+ - Add shortcuts for navigation(tabbed panes key bindings)
+ - Tabbed panes do not open multiple, always only one. (Sprint: 1.5)
+ - Saving asterisk shown when unsaved shows file is unsaved
+ when user types and deletes or deletes and types same character
+ (does not recognize that file didn't really change
+ when user typed and deleted words)
+ Find & Replace:
+ - Find and replace starts not on first occurrence
+ - Find and Replace issue
+ - File search "**********" directs to top of page
+ - after searching once, replacing the text freezes program.
+
+ - New Features Coming:
+ - Method to "Check for updates" and update by downloading newer version.
+ - Choose whether text should be saved in plain text or rich text
+ and how to implement(show and edit) in the window.
+ - Option to choose whether file saves automatically before
+ program closes.
+ - Project structure/path display
+ - Tabbed panes for different files. (make sure user can access tabs
+ using key bindings command+tab-number)
+ - PDF creator.
+ - Text completion ~ @textCompletionConcept.java
+ - On selecting(double clicking text and two finger clicking)
+ check for spelling mistakes in word
+ - Highlight/underline words misspelled with checker
+ every 5 character changes.
+ - Make executable file(.dmg, .exe) for multi-platform use
+ without JDK, etc.
+ - Run Java and .txt(java) files
+ - With compile
+ - Without compile
+ - Create folder with compile and source
+ - Delete previous version
+
+ New In This Version:
+ - Find and Replace
+ - New "Find Previous" function added.
+ - Rename file feature added to menu (Menu -> Rename).
+ - Text completion Scheduled
+ - Alpha (Sprint: 2.0)
+ - Beta (Sprint: 2.4)
+ - Implemented (Sprint: 3.0)
+ - Fixes (7)
+ - 00004 -> Fixed issue where file opened has a blank first line.
+ - 00005 -> Fixed Find and Replace so selection does not repeat
+ on single occurrence.
+ - 00006 -> Fixed file doesn't save when user opens another
+ file in same tab.
+ - 00007 -> Setting metal P.L.A.F. as default may give
+ ocean theme instead of default-metal.
+ - 00008 -> File is erased when user reopens
+ same file(unsaved).
+ - 00009 -> Issue where user needs to save file(shows file dialog) when opening
+ from a blank file.
+ - 00010 -> Issue where user saves file after unsaved prompt and
+ doesn't see frame(setVisible is false).
+
+
+Version 1.2 04072020:
+ - Introducing tabbed panes
+ - for multiple windows (Sprint: 1.5)
+ - Key bindings support (Sprint: 1.5)
+ - Auto-save setting is available
+ - MacOS Application available.
+
+Version 1.1 02072020:
+ - Find and Replace function fully functional.
+ - Option to replace all added.
+ - Fixed issue where one occurrence is skipped.
+ - Cut, copy and paste functions are now fully functional.
+
+Version 1.0 23062020:
+ - Combined all of the following.
+
+Version 0.6 20062020:
+ - Bug fixes and patches
+ - Theme now can be set as default.
+ - Themes instantly take effect when radio button clicked.
+ - Themes are shown in a JList format as there are 19 themes.
+ - More themes, below shown:
+ - Metal (2)
+ - Metal
+ - Ocean
+ - JTattoo (12)
+ - Acryl
+ - Aero
+ - Aluminium
+ - Bernstein
+ - Fast
+ - HiFi
+ - McWin
+ - Mint
+ - Noire
+ - Smart
+ - Luna (similar to Smart)
+ - Texture
+ - Original (system)
+ - Nimbus
+ - Motif
+ - PGS (PagoSoft)
+
+Version 0.5 18062020:
+ - Cut, copy and paste functions are also available on the menu bar from "Edit".
+ - Reduced Java Archive size to 2.65MB
+ - Bug fixes and patches.
+
+Version 0.4 14062020:
+ - Added support for different characters and languages
+ - Chinese, English
+ - All unicode characters
+ - Improved order of menu items for ease of use
+ - Key bindings
+ - Ctrl-A -> Select All
+ - Alt-Del -> Delete word
+ - Ctrl-X -> Cut
+ - Ctrl-V -> Paste
+ - Ctrl-C -> Copy
+ - Ctrl-Q -> Quit
+ - Ctrl-Z -> Undo
+ - Tab -> Insert Tab
+
+Version 0.3 14062020:
+ - Save and open settings added and fully functional.
+ - Resized settings frame to fit "set as default" button.
+ - Added scroll bar to frame for better navigation.
+ - Fixes (3):
+ - 00001 -> Exiting frame is laggy and slow, throws NullPointerException
+ - 00002 -> File path issue where jar execution throws Exception
+ - 00003 -> Default text file not savable in jar
+ - Folder in users' default directory will be created named
+ "SmartEditor" with default settings file in it.
+
+Version 0.2 13062020:
+ - "Set as Default" for font family, size and background, foreground colors.
+ - Implemented change listeners to see instant effect of changing font, etc.
+ - Implemented color palette for choosing colors from Swatches, RGB, CMYK, et al.
+ - Renamed frame to say "Untitled.txt".
+
+Version 0.1 13062020:
+ - Frame set-up
+ - JMenuBar with settings, save and open settings.
+ - Overall structure of frame Complete
diff --git a/docs/d1.jpg b/docs/d1.jpg
new file mode 100644
index 0000000..8f9c9b3
Binary files /dev/null and b/docs/d1.jpg differ
diff --git a/docs/d1.png b/docs/d1.png
index 572b153..7190b48 100644
Binary files a/docs/d1.png and b/docs/d1.png differ
diff --git a/docs/d2.jpg b/docs/d2.jpg
new file mode 100644
index 0000000..23add91
Binary files /dev/null and b/docs/d2.jpg differ
diff --git a/docs/d2.png b/docs/d2.png
index 3976da7..5893c19 100644
Binary files a/docs/d2.png and b/docs/d2.png differ
diff --git a/docs/d3.jpg b/docs/d3.jpg
new file mode 100644
index 0000000..933ccb5
Binary files /dev/null and b/docs/d3.jpg differ
diff --git a/docs/d3.png b/docs/d3.png
index 316c7dd..971c0e9 100644
Binary files a/docs/d3.png and b/docs/d3.png differ
diff --git a/docs/d4.jpg b/docs/d4.jpg
new file mode 100644
index 0000000..53e9c14
Binary files /dev/null and b/docs/d4.jpg differ
diff --git a/docs/d4.png b/docs/d4.png
index 1d5f72d..9651f19 100644
Binary files a/docs/d4.png and b/docs/d4.png differ
diff --git a/docs/d5.jpg b/docs/d5.jpg
new file mode 100644
index 0000000..15b9275
Binary files /dev/null and b/docs/d5.jpg differ
diff --git a/docs/d5.png b/docs/d5.png
index 38867a4..842e572 100644
Binary files a/docs/d5.png and b/docs/d5.png differ
diff --git a/docs/d6.jpg b/docs/d6.jpg
new file mode 100644
index 0000000..02f9d1b
Binary files /dev/null and b/docs/d6.jpg differ
diff --git a/docs/d6.png b/docs/d6.png
index 202796e..f39503f 100644
Binary files a/docs/d6.png and b/docs/d6.png differ
diff --git a/docs/dark.jpg b/docs/dark.jpg
new file mode 100644
index 0000000..57fe118
Binary files /dev/null and b/docs/dark.jpg differ
diff --git a/docs/dark.png b/docs/dark.png
index 31fda50..70ca9a3 100644
Binary files a/docs/dark.png and b/docs/dark.png differ
diff --git a/docs/index.html b/docs/index.html
index 0ae985b..b217259 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -2,20 +2,16 @@
-
-
-
-
+
+
+
+
SmartEditor