diff --git a/.idea/dictionaries/mmk2410.xml b/.idea/dictionaries/mmk2410.xml
new file mode 100644
index 0000000..7252c68
--- /dev/null
+++ b/.idea/dictionaries/mmk2410.xml
@@ -0,0 +1,86 @@
+
+
+
+ abteilung
+ affero
+ aktivieren
+ aktuelle
+ aktuellste
+ anleitung
+ aufmerksam
+ ausführliche
+ beim
+ bereinigen
+ bist
+ bitte
+ dann
+ diese
+ eine
+ einen
+ einfügen
+ entwickler
+ erfolgreich
+ fadb
+ fehlenden
+ fehlender
+ fehler
+ finden
+ fullname
+ geben
+ gefunden
+ geworden
+ herunterladen
+ hgap
+ hsize
+ hspacer
+ installieren
+ kannst
+ kontakt
+ kopieren
+ letterspace
+ lgpl
+ licensors
+ lizenz
+ marcelkapfer
+ mehr
+ möglich
+ neues
+ nich
+ nicht
+ nochmal
+ noncommercially
+ normales
+ recognization
+ relicensing
+ schließen
+ schreibe
+ scrollpane
+ später
+ starten
+ sublicenses
+ sublicensing
+ sudo
+ suppressions
+ tabbedpane
+ trat
+ trello
+ umwandler
+ verbindung
+ verfügbar
+ verfügbarr
+ versuch
+ versuchen
+ verwendest
+ verzeichniss
+ vgap
+ vsize
+ wenn
+ willst
+ wipo
+ writtenmorse
+ änderungen
+ über
+ überprüfen
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9100e4e..1556fe5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -21,22 +21,6 @@
-
-
-
-
-
-
-
-
-
-
- Android
-
-
-
-
-
@@ -47,7 +31,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 00cab75..9e7b5b2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,23 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -42,36 +31,49 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
+
@@ -79,8 +81,8 @@
-
-
+
+
@@ -89,8 +91,8 @@
-
-
+
+
@@ -99,8 +101,8 @@
-
-
+
+
@@ -109,28 +111,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -139,13 +121,20 @@
-
-
+
+
+
+
+
+
+
+
+
@@ -174,22 +163,22 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
@@ -203,12 +192,26 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
@@ -221,7 +224,7 @@
-
+
@@ -231,115 +234,13 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -349,9 +250,10 @@
-
+
+
@@ -367,22 +269,21 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -392,18 +293,15 @@
+
-
-
-
-
-
-
-
-
+
+
+
+
@@ -526,7 +424,14 @@
-
+
+
+
+
+
+
+
+
@@ -535,81 +440,132 @@
1433089656410
+
1433089656410
1433107293071
+
1433107293071
1433194444611
+
1433194444611
1433258706216
+
1433258706216
1433259123531
+
1433259123531
1433407147891
+
1433407147891
1433839149994
+
1433839149994
1433840210547
+
1433840210547
-
+
+ 1438264240701
+
+
+
+ 1438264240701
+
+
+ 1440078640432
+
+
+
+ 1440078640432
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -630,29 +586,14 @@
-
+
+
+
+
-
- file://$PROJECT_DIR$/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
- 58
-
-
-
-
- file://$PROJECT_DIR$/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
- 59
-
-
-
-
- file://$PROJECT_DIR$/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
- 57
-
-
-
file://$PROJECT_DIR$/src/de/marcelkapfer/c/morseconverter/engine/EncodeWrittenMorseManager.java
198
@@ -708,34 +649,23 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -743,49 +673,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -797,7 +727,7 @@
-
+
@@ -805,56 +735,56 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -862,7 +792,7 @@
-
+
@@ -870,49 +800,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -924,7 +854,7 @@
-
+
@@ -937,135 +867,50 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
@@ -1073,9 +918,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -1084,13 +1013,22 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1170,7 +1108,7 @@
- 1.8
+ 1.7
diff --git a/README.md b/README.md
index 74e6096..8f5e85a 100755
--- a/README.md
+++ b/README.md
@@ -1,43 +1,43 @@
-Morse Converter
-===============
+# Morse Converter (Desktop Client)
-A writtenMorse and normal morse code converter.
-A detailed description about this program can be found on http://marcel-kapfer.de/writtenmorse.
+A writtenMorse and normal Morse code converter.
+A detailed description about this program can be found on the [GitLab Wiki](https://gitlab.com/mmk2410/writtenmorse-specs/wikis/Home).
-## Content
- - [Contribute](#contribute)
- - [Trello Board](#trello-board)
- - [Packages](#packages)
- - [Linux](#linux)
- - [ubuntu](#ubuntu)
+## Prerequisites
+
+ * 2.0 or later: Java 8 or higher
+ - 2.0 or earlier: Java 6 or higher
+
+## Contributing
-## Contribute
1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. **Create New Pull Request**
+2. Create a feature branch with a meaningful name (`git checkout -b my-new-feature`)
+3. Add yourself to the CONTRIBUTORS file
+4. Commit your changes (`git commit -am 'Add some feature'`)
+5. Push to your branch (`git push origin my-new-feature`)
+6. Create a new merge request
-Feel free to write me a mail at marcelmichaelkapfer@yahoo.co.nz or contact me on [Google+](https://plus.google.com/+MarcelMichaelKapfer) or [Twitter](https://twitter.com/MarcelKapfer).
-
-
-You should also check out the issues and the Trello board.
-
-## Trello Board
-
-[Feature & Development Board](https://trello.com/b/OUoy2iHg/morse-computer)
+If you have any questions feel free to write me a mail at [me@mmk2410.org](mailto:me@mmk2410.org) or contact me on [Twitter](https://twitter.com/mmk2410). If your question is more general, don't hesitate to create an issue.
## Packages
+
### Linux
+
#### Ubuntu
I created an Ubuntu repository for the app. You can use it by running the following lines:
-``sudo apt-add-repository ppa:mmk2410/morse-converter``
+```
+sudo apt-add-repository ppa:mmk2410/morse-converter
-``sudo apt-get update``
+sudo apt-get update
-``sudo apt-get install morse-converter``
+sudo apt-get install morse-converter
+```
-[Launchpad](https://launchpad.net/~mmk2410/+archive/ubuntu/morse-converter)
+View this package repository at [Launchpad](https://launchpad.net/~mmk2410/+archive/ubuntu/morse-converter).
+
+#### Debian
+
+You can use the Ubuntu packages (or even the repository) with Debian.
diff --git a/src/de/marcelkapfer/c/morseconverter/Main.form b/src/de/marcelkapfer/c/morseconverter/Main.form
index ae24b9d..ab82c83 100755
--- a/src/de/marcelkapfer/c/morseconverter/Main.form
+++ b/src/de/marcelkapfer/c/morseconverter/Main.form
@@ -145,6 +145,7 @@
+
@@ -160,4 +161,7 @@
+
+
+
diff --git a/src/de/marcelkapfer/c/morseconverter/Main.java b/src/de/marcelkapfer/c/morseconverter/Main.java
index 03fd24f..f565a00 100755
--- a/src/de/marcelkapfer/c/morseconverter/Main.java
+++ b/src/de/marcelkapfer/c/morseconverter/Main.java
@@ -36,21 +36,22 @@ import javax.swing.text.Element;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.*;
import java.io.IOException;
import java.util.ResourceBundle;
public class Main extends JFrame {
// Version numbers for update check
- public static final int currentVersion = 193;
+ public static final int currentVersion = 200;
public static int latestVersion = currentVersion;
- public static ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
- public JTabbedPane morseConverterPane;
+ private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
+ private JTabbedPane morseConverterPane;
private JPanel panel1;
private JTextArea inputAreaWrittenMorse;
private JTextArea outputAreaWrittenMorse;
@@ -95,13 +96,128 @@ public class Main extends JFrame {
updateDialogButton.setText(resourceBundle.getString("aboutUpdateAvailableButton"));
}
- updateDialogButton.addActionListener(new ActionListener() {
+ updateDialogButton.addActionListener(e -> updateDialog());
+
+ // Mouse listener for selecting text on left click in output text area
+ outputAreaWrittenMorse.addMouseListener(new MouseListener() {
@Override
- public void actionPerformed(ActionEvent e) {
- updateDialog();
+ public void mouseClicked(MouseEvent e) {
+
}
+ @Override
+ public void mousePressed(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ if (e.getButton() == MouseEvent.BUTTON1) {
+ outputAreaWrittenMorse.requestFocus();
+ outputAreaWrittenMorse.selectAll();
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+
+ }
});
+
+ outputAreaNormalMorse.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ if (e.getButton() == MouseEvent.BUTTON1) {
+ outputAreaNormalMorse.requestFocus();
+ outputAreaNormalMorse.selectAll();
+ }
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+
+ }
+ });
+
+ // Popup Menus
+
+ // Popup Menu for writtenMorse input text field
+
+ JPopupMenu wInputPopup = new JPopupMenu();
+ addPopup(inputAreaWrittenMorse, wInputPopup);
+
+ // Item for paste
+ JMenuItem pasteWInput = new JMenuItem(resourceBundle.getString("paste"));
+ pasteWInput.addActionListener(e -> {
+ onPaste(inputAreaWrittenMorse);
+ instantWrittenMorseConvert();
+ });
+ wInputPopup.add(pasteWInput);
+
+ // Item for clear
+ JMenuItem clearWInput = new JMenuItem(resourceBundle.getString("clear"));
+ clearWInput.addActionListener(e -> clear(inputAreaWrittenMorse));
+ wInputPopup.add(clearWInput);
+
+ // Popup Menu for writtenMorse output text field
+ JPopupMenu wOutputPopup = new JPopupMenu();
+ addPopup(outputAreaWrittenMorse, wOutputPopup);
+
+ // Item for copy
+ JMenuItem copyWOutput = new JMenuItem(resourceBundle.getString("copy"));
+ copyWOutput.addActionListener(e -> onCopy(outputAreaWrittenMorse));
+ wOutputPopup.add(copyWOutput);
+
+
+ // Popups for Normal Morse
+
+ // Popup for Normal Morse input text field
+ JPopupMenu nInputMenu = new JPopupMenu();
+ addPopup(inputAreaNormalMorse, nInputMenu);
+
+ // Item for paste
+ JMenuItem nPasteInput = new JMenuItem(resourceBundle.getString("paste"));
+ nPasteInput.addActionListener(e -> {
+ onPaste(inputAreaNormalMorse);
+ instantNormalMorseConvert();
+ });
+ nInputMenu.add(nPasteInput);
+
+ // Item for clear
+ JMenuItem nClearInput = new JMenuItem(resourceBundle.getString("clear"));
+ nClearInput.addActionListener(e -> clear(inputAreaNormalMorse));
+ nInputMenu.add(nClearInput);
+
+ // Popup for output text field
+
+ JPopupMenu nOutputMenu = new JPopupMenu();
+ addPopup(outputAreaNormalMorse, nOutputMenu);
+
+ // Menu item for copy
+ JMenuItem nCopyOutput = new JMenuItem(resourceBundle.getString("copy"));
+ nCopyOutput.addActionListener(e -> onCopy(outputAreaNormalMorse));
+ nOutputMenu.add(nCopyOutput);
+
}
// The holy main method
public static void main(String[] args){
@@ -114,7 +230,7 @@ public class Main extends JFrame {
// Starting the application
JFrame main = new JFrame("Main");
main.setContentPane(new Main().morseConverterPane);
- main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
// Title
main.setTitle(resourceBundle.getString("title"));
main.pack();
@@ -158,4 +274,55 @@ public class Main extends JFrame {
UpdateDialog.main(null);
}
+ private static void addPopup(Component component, final JPopupMenu popup) {
+ component.addMouseListener(new MouseAdapter() {
+ public void mousePressed(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ showMenu(e);
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ showMenu(e);
+ }
+ }
+
+ private void showMenu(MouseEvent e) {
+ popup.show(e.getComponent(), e.getX(), e.getY());
+ }
+ });
+ }
+
+ /*
+ * Past function
+ */
+ private void onPaste(JTextArea tf) {
+ try {
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
+ Transferable t = c.getContents(this);
+ if (t == null)
+ return;
+ try {
+ tf.setText((String) t.getTransferData(DataFlavor.stringFlavor));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }// try
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }// onPaste
+
+ /*
+ * Copy function
+ */
+ private void onCopy(JTextArea tf) {
+ StringSelection selection = new StringSelection(tf.getText());
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ clipboard.setContents(selection, selection);
+ }
+
+ private void clear(JTextArea jTextArea) {
+ jTextArea.setText("");
+ }
}
diff --git a/src/de/marcelkapfer/c/morseconverter/engine/DecodeNormalMorseManager.java b/src/de/marcelkapfer/c/morseconverter/engine/DecodeNormalMorseManager.java
index 2fbea3e..375c705 100755
--- a/src/de/marcelkapfer/c/morseconverter/engine/DecodeNormalMorseManager.java
+++ b/src/de/marcelkapfer/c/morseconverter/engine/DecodeNormalMorseManager.java
@@ -34,7 +34,7 @@ public class DecodeNormalMorseManager {
// Variables
StringBuffer input = new StringBuffer();
input = input.replace(0, input.length(), message.toString().toUpperCase());
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
if (input.toString().equals("LETTERSPACE")) {
output.replace(0, output.length(), " ");
} else if (input.toString().equals("END OF WORK")) {
diff --git a/src/de/marcelkapfer/c/morseconverter/engine/DecodeWrittenMorseManager.java b/src/de/marcelkapfer/c/morseconverter/engine/DecodeWrittenMorseManager.java
index c2a696e..920c45c 100755
--- a/src/de/marcelkapfer/c/morseconverter/engine/DecodeWrittenMorseManager.java
+++ b/src/de/marcelkapfer/c/morseconverter/engine/DecodeWrittenMorseManager.java
@@ -34,7 +34,7 @@ public class DecodeWrittenMorseManager {
// Variables
StringBuffer input = new StringBuffer();
input = input.replace(0, input.length(), message.toString().toUpperCase());
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
if (input.toString().equals("LETTERSPACE")) {
output.replace(0, output.length(), "#");
} else if (input.toString().equals("END OF WORK")) {
diff --git a/src/de/marcelkapfer/c/morseconverter/engine/EncodeNormalMorseManager.java b/src/de/marcelkapfer/c/morseconverter/engine/EncodeNormalMorseManager.java
index 232fcc8..92e8faa 100755
--- a/src/de/marcelkapfer/c/morseconverter/engine/EncodeNormalMorseManager.java
+++ b/src/de/marcelkapfer/c/morseconverter/engine/EncodeNormalMorseManager.java
@@ -38,16 +38,16 @@ public class EncodeNormalMorseManager {
}
// Declaring variables
String input;
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
input = message.toString() + " ";
input = input.replace(System.lineSeparator(), "\n");
input = input.replace("\r", "\n");
input = input.replace("\r\n", "\n");
- StringBuffer inputToSign = new StringBuffer(input);
+ StringBuilder inputToSign = new StringBuilder(input);
while (!inputToSign.toString().equals(" ")) {
int d = 0;
boolean signFull = true;
- StringBuffer sign = new StringBuffer();
+ StringBuilder sign = new StringBuilder();
while (signFull) {
if (inputToSign.toString().startsWith(" ")) {
output.append(" ");
diff --git a/src/de/marcelkapfer/c/morseconverter/engine/EncodeWrittenMorseManager.java b/src/de/marcelkapfer/c/morseconverter/engine/EncodeWrittenMorseManager.java
index 2450788..7da3d43 100755
--- a/src/de/marcelkapfer/c/morseconverter/engine/EncodeWrittenMorseManager.java
+++ b/src/de/marcelkapfer/c/morseconverter/engine/EncodeWrittenMorseManager.java
@@ -37,16 +37,16 @@ public class EncodeWrittenMorseManager {
}
// Variables
String input;
- StringBuffer output = new StringBuffer();
+ StringBuilder output = new StringBuilder();
input = message.toString().toUpperCase() + "#";
input = input.replace(System.lineSeparator(), "\n");
input = input.replace("\r", "\n");
input = input.replace("\r\n", "\n");
- StringBuffer inputToSign = new StringBuffer(input);
+ StringBuilder inputToSign = new StringBuilder(input);
while (!inputToSign.toString().equals("#")) {
int d = 0;
boolean signFull = true;
- StringBuffer sign = new StringBuffer();
+ StringBuilder sign = new StringBuilder();
while (signFull) {
if (inputToSign.toString().charAt(d) == '+'
|| inputToSign.toString().charAt(d) == '#'
diff --git a/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/NormalMorseCodeRecognization.java b/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/NormalMorseCodeRecognization.java
index eb0431f..06d6c3a 100755
--- a/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/NormalMorseCodeRecognization.java
+++ b/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/NormalMorseCodeRecognization.java
@@ -22,13 +22,14 @@ package de.marcelkapfer.c.morseconverter.intelligentCodeRecognization;
*/
/**
- * Created by mmk on 5/31/15.
+ * Marcel Kapfer (mmk2410)
+ * Licensed under
*/
public class NormalMorseCodeRecognization {
public static Boolean isCode(String input){
input = input.toLowerCase();
- if(input.contains("a") || input.contains("b") ||
+ return !(input.contains("a") || input.contains("b") ||
input.contains("c") || input.contains("d") ||
input.contains("e") || input.contains("f") ||
input.contains("g") || input.contains("h") ||
@@ -54,11 +55,7 @@ public class NormalMorseCodeRecognization {
input.contains("+") || input.contains("_") ||
input.contains("(") || input.contains(")") ||
input.contains("=") || input.contains("/") ||
- input.contains("@") || input.contains("'")){
- return false;
- } else {
- return true;
- }
+ input.contains("@") || input.contains("'"));
}
}
diff --git a/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java b/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
index 0431fee..8f644f2 100755
--- a/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
+++ b/src/de/marcelkapfer/c/morseconverter/intelligentCodeRecognization/WrittenMorseCodeRecognization.java
@@ -22,13 +22,14 @@ package de.marcelkapfer.c.morseconverter.intelligentCodeRecognization;
*/
/**
- * Created by mmk on 5/31/15.
+ * Marcel Kapfer (mmk2410)
+ * Licensed under
*/
public class WrittenMorseCodeRecognization {
public static Boolean isCode(String input){
input = input.toLowerCase();
- if(input.contains("a") || input.contains("b") ||
+ return !(input.contains("a") || input.contains("b") ||
input.contains("c") || input.contains("d") ||
input.contains("e") || input.contains("f") ||
input.contains("g") || input.contains("h") ||
@@ -54,11 +55,7 @@ public class WrittenMorseCodeRecognization {
input.contains("(") || input.contains(")") ||
input.contains("=") || input.contains("/") ||
input.contains("@") || input.contains("'") ||
- input.contains("$")){
- return false;
- } else {
- return true;
- }
+ input.contains("$"));
}
}
diff --git a/src/de/marcelkapfer/c/morseconverter/text.properties b/src/de/marcelkapfer/c/morseconverter/text.properties
index 61aa48e..968d575 100755
--- a/src/de/marcelkapfer/c/morseconverter/text.properties
+++ b/src/de/marcelkapfer/c/morseconverter/text.properties
@@ -1,7 +1,10 @@
-about=\n\nVersion 1.9.3 beta\n
\n\nDeveloper Marcel Michael Kapfer\n
\n\nWebsite marcel-kapfer.de/writtenmorse\n
\n\nContact marcelmichaelkapfer@yahoo.co.nz\n
\n\nLicense GNU GPL v3.0\n
\n\nBug If you found a bug, please write me a mail to marcelmichaelkapfer@yahoo.co.nz with a short description of the problem.\n
\n\nHow to You can find a detailed guide on marcel-kapfer.de/writtenmorse/\#howto_desktop\n
\nMissing Code If you discovered, that a code is missing, then write me a mail to marcelmichaelkapfer@yahoo.co.nz and tell me about it.\n
\n
\n
-aboutUpdateAvailable=Update available
+about=\n\nVersion 2.0.0\n
\n\nDeveloper Marcel Michael Kapfer\n
\n\nWebsite marcel-kapfer.de/writtenmorse\n
\n\nContact marcelmichaelkapfer@yahoo.co.nz\n
\n\nLicense GNU GPL v3.0\n
\n\nBug If you found a bug, please write me a mail to marcelmichaelkapfer@yahoo.co.nz with a short description of the problem.\n
\n\nHow to You can find a detailed guide on marcel-kapfer.de/writtenmorse/\#howto_desktop\n
\nMissing Code If you discovered, that a code is missing, then write me a mail to marcelmichaelkapfer@yahoo.co.nz and tell me about it.\n
\n\n
+aboutUpdateAvailable=&Update available
aboutUpdateAvailableButton=Install Update
+clear=Clear
+copy=Copy
inputText=Enter your text
+paste=Paste
tabAbout=About
tabNormalMorse=Normal Morse
title=Morse Converter
@@ -10,7 +13,7 @@ update-no-connection=The connection to the server was not possible.\nTry again l
update-not-successful=Update not successful
update-successful=Update successful.\nPlease restart the software to activate the changes.
updateAvailable=An Update is available\!\nGo to the 'About' section for more.
-updateButton=Check for updates
+updateButton=&Check for updates
updateDialogClose=Close
updateDialogNewVersion=A new version of the Morse Converter is available.
updateDialogUpToDateText=You're running the latest version.
diff --git a/src/de/marcelkapfer/c/morseconverter/text_de.properties b/src/de/marcelkapfer/c/morseconverter/text_de.properties
index b6693af..cc984d8 100755
--- a/src/de/marcelkapfer/c/morseconverter/text_de.properties
+++ b/src/de/marcelkapfer/c/morseconverter/text_de.properties
@@ -1,7 +1,10 @@
-about=\n\nVersion 1.9.3 beta\n
\n\nEntwickler Marcel Michael Kapfer\n
\n\nWebsite marcel-kapfer.de/writtenmorse\n
\n\nKontakt marcelmichaelkapfer@yahoo.co.nz\n
\n\nLizenz GNU GPL v3.0\n
\n\nFehler Wenn Du einen Fehler gefunden hast, schreibe mir bitte ein E-Mail an marcelmichaelkapfer@yahoo.co.nz\n
\n\nHow to Du kannst eine ausführliche Anleitung auf marcel-kapfer.de/writtenmorse/\#howto_android finden.\n
\nFehlender Code Wenn Du auf einen fehlenden Code aufmerksam geworden bist, dann schreibe eine E-Mail an marcelmichaelkapfer@yahoo.co.nz.\n
\n\n
+about=\n\nVersion 2.0.0\n
\n\nEntwickler Marcel Michael Kapfer\n
\n\nWebsite marcel-kapfer.de/writtenmorse\n
\n\nKontakt marcelmichaelkapfer@yahoo.co.nz\n
\n\nLizenz GNU GPL v3.0\n
\n\nFehler Wenn Du einen Fehler gefunden hast, schreibe mir bitte ein E-Mail an marcelmichaelkapfer@yahoo.co.nz\n
\n\nHow to Du kannst eine ausführliche Anleitung auf marcel-kapfer.de/writtenmorse/\#howto_android finden.\n
\nFehlender Code Wenn Du auf einen fehlenden Code aufmerksam geworden bist, dann schreibe eine E-Mail an marcelmichaelkapfer@yahoo.co.nz.\n
\n\n
aboutUpdateAvailable=Update verfügbar
aboutUpdateAvailableButton=Update installieren
+clear=Bereinigen
+copy=Kopieren
inputText=Geben Sie einen Text ein
+paste=Einfügen
tabAbout=Über
tabNormalMorse=Normales Morse
title=Morse Umwandler
diff --git a/src/de/marcelkapfer/c/morseconverter/update/Update.java b/src/de/marcelkapfer/c/morseconverter/update/Update.java
index 371d299..92387f2 100755
--- a/src/de/marcelkapfer/c/morseconverter/update/Update.java
+++ b/src/de/marcelkapfer/c/morseconverter/update/Update.java
@@ -39,7 +39,7 @@ public class Update {
* Argument: The URL of the file with the version number as a string
*
*/
- public static boolean isConnected(String url){
+ public static boolean isConnected(@SuppressWarnings("SameParameterValue") String url){
try {
update = new URL(url);
update.openStream();
@@ -57,7 +57,7 @@ public class Update {
* Arguments: The path where the jar file is located, the name of the jar file
*
*/
- public static boolean update(String path, String filename){
+ public static boolean update(String path, @SuppressWarnings("SameParameterValue") String filename){
try {
ReadableByteChannel updateChannel = Channels.newChannel(update.openStream());
FileOutputStream updateOutputStream = new FileOutputStream(path + filename);
@@ -78,6 +78,7 @@ public class Update {
* It is highly recommended to give also the version number of the current version as an argument
*
*/
+ @SuppressWarnings("unused")
public static int getLatestVersion(String versionFile){
return getLatestVersion(versionFile, 0);
}
diff --git a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.form b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.form
index 4a283f2..8051d14 100755
--- a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.form
+++ b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.form
@@ -3,7 +3,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
@@ -42,7 +42,7 @@
-
+
diff --git a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java
index 636f3dc..f199c79 100755
--- a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java
+++ b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java
@@ -32,13 +32,13 @@ import java.util.ResourceBundle;
public class UpdateDialog extends JDialog {
private JPanel contentPane;
- public JButton buttonOK;
- public JButton buttonCancel;
- public JLabel updateDialogQuestion;
- public JLabel updateDialogNewVersion;
- private ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
+ private JButton buttonOK;
+ private JButton buttonCancel;
+ private JLabel updateDialogQuestion;
+ private JLabel updateDialogNewVersion;
+ private final ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
- public UpdateDialog() {
+ private UpdateDialog() {
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
@@ -48,17 +48,9 @@ public class UpdateDialog extends JDialog {
updateDialogNewVersion.setVisible(false);
updateDialogQuestion.setText(resourceBundle.getString("updateDialogUpToDateText"));
}
- buttonOK.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- onOK();
- }
- });
+ buttonOK.addActionListener(e -> onOK());
- buttonCancel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- onCancel();
- }
- });
+ buttonCancel.addActionListener(e -> onCancel());
// call onCancel() when cross is clicked
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
@@ -69,11 +61,7 @@ public class UpdateDialog extends JDialog {
});
// call onCancel() on ESCAPE
- contentPane.registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- onCancel();
- }
- }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
private void onOK() {