From 85261470cc108c62bcc4292d1557efbf1df6a79f Mon Sep 17 00:00:00 2001
From: "Marcel Kapfer (mmk2410)"
Date: Fri, 15 Apr 2016 17:49:40 +0200
Subject: [PATCH] Update to meet Google Java Coding Guidlines
---
.idea/dictionaries/mmk2410.xml | 86 ++
.idea/misc.xml | 18 +-
.idea/workspace.xml | 796 ++++++++----------
.../marcelkapfer/c/morseconverter/Main.form | 4 +
.../marcelkapfer/c/morseconverter/Main.java | 60 +-
.../engine/DecodeNormalMorseManager.java | 2 +-
.../engine/DecodeWrittenMorseManager.java | 2 +-
.../engine/EncodeNormalMorseManager.java | 6 +-
.../engine/EncodeWrittenMorseManager.java | 6 +-
.../NormalMorseCodeRecognization.java | 11 +-
.../WrittenMorseCodeRecognization.java | 11 +-
.../c/morseconverter/text.properties | 4 +-
.../c/morseconverter/update/Update.java | 5 +-
.../c/morseconverter/update/UpdateDialog.form | 6 +-
.../c/morseconverter/update/UpdateDialog.java | 30 +-
15 files changed, 474 insertions(+), 573 deletions(-)
create mode 100644 .idea/dictionaries/mmk2410.xml
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 ead862e..f1b8836 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -10,11 +7,21 @@
+
+
+
+
+
+
+
+
+
-
-
+
+
+
@@ -38,39 +45,44 @@
-
+
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -78,13 +90,13 @@
-
-
-
+
+
+
-
+
@@ -92,18 +104,12 @@
-
-
+
+
-
-
-
-
-
-
-
-
+
+
@@ -112,8 +118,8 @@
-
-
+
+
@@ -122,8 +128,8 @@
-
-
+
+
@@ -132,30 +138,27 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
@@ -187,22 +190,22 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -216,13 +219,26 @@
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
@@ -245,9 +261,12 @@
+
+
+
@@ -256,100 +275,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -359,7 +291,6 @@
-
@@ -379,22 +310,21 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -404,18 +334,15 @@
+
-
-
-
-
-
-
-
-
+
+
+
+
@@ -538,7 +465,14 @@
-
+
+
+
+
+
+
+
+
@@ -547,86 +481,104 @@
1433089656410
+
1433089656410
1433107293071
+
1433107293071
1433194444611
+
1433194444611
1433258706216
+
1433258706216
1433259123531
+
1433259123531
1433407147891
+
1433407147891
1433839149994
+
1433839149994
1433840210547
+
1433840210547
1438264240701
+
1438264240701
-
+
+ 1440078640432
+
+
+
+ 1440078640432
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -656,24 +608,6 @@
-
- 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
@@ -731,91 +665,80 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -827,84 +750,73 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -912,77 +824,66 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -994,28 +895,17 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -1027,138 +917,49 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -1167,21 +968,96 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -1189,31 +1065,31 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1295,7 +1171,7 @@
- 1.8
+ 1.7
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 282a87e..f565a00 100755
--- a/src/de/marcelkapfer/c/morseconverter/Main.java
+++ b/src/de/marcelkapfer/c/morseconverter/Main.java
@@ -50,8 +50,8 @@ public class Main extends JFrame {
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;
@@ -96,13 +96,7 @@ public class Main extends JFrame {
updateDialogButton.setText(resourceBundle.getString("aboutUpdateAvailableButton"));
}
- updateDialogButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- updateDialog();
- }
-
- });
+ updateDialogButton.addActionListener(e -> updateDialog());
// Mouse listener for selecting text on left click in output text area
outputAreaWrittenMorse.addMouseListener(new MouseListener() {
@@ -174,23 +168,15 @@ public class Main extends JFrame {
// Item for paste
JMenuItem pasteWInput = new JMenuItem(resourceBundle.getString("paste"));
- pasteWInput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- onPaste(inputAreaWrittenMorse);
- instantWrittenMorseConvert();
- }
+ pasteWInput.addActionListener(e -> {
+ onPaste(inputAreaWrittenMorse);
+ instantWrittenMorseConvert();
});
wInputPopup.add(pasteWInput);
// Item for clear
JMenuItem clearWInput = new JMenuItem(resourceBundle.getString("clear"));
- clearWInput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- clear(inputAreaWrittenMorse);
- }
- });
+ clearWInput.addActionListener(e -> clear(inputAreaWrittenMorse));
wInputPopup.add(clearWInput);
// Popup Menu for writtenMorse output text field
@@ -199,12 +185,7 @@ public class Main extends JFrame {
// Item for copy
JMenuItem copyWOutput = new JMenuItem(resourceBundle.getString("copy"));
- copyWOutput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- onCopy(outputAreaWrittenMorse);
- }
- });
+ copyWOutput.addActionListener(e -> onCopy(outputAreaWrittenMorse));
wOutputPopup.add(copyWOutput);
@@ -216,23 +197,15 @@ public class Main extends JFrame {
// Item for paste
JMenuItem nPasteInput = new JMenuItem(resourceBundle.getString("paste"));
- nPasteInput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- onPaste(inputAreaNormalMorse);
- instantNormalMorseConvert();
- }
+ nPasteInput.addActionListener(e -> {
+ onPaste(inputAreaNormalMorse);
+ instantNormalMorseConvert();
});
nInputMenu.add(nPasteInput);
// Item for clear
JMenuItem nClearInput = new JMenuItem(resourceBundle.getString("clear"));
- nClearInput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- clear(inputAreaNormalMorse);
- }
- });
+ nClearInput.addActionListener(e -> clear(inputAreaNormalMorse));
nInputMenu.add(nClearInput);
// Popup for output text field
@@ -240,14 +213,9 @@ public class Main extends JFrame {
JPopupMenu nOutputMenu = new JPopupMenu();
addPopup(outputAreaNormalMorse, nOutputMenu);
- // Menü item for copy
+ // Menu item for copy
JMenuItem nCopyOutput = new JMenuItem(resourceBundle.getString("copy"));
- nCopyOutput.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- onCopy(outputAreaNormalMorse);
- }
- });
+ nCopyOutput.addActionListener(e -> onCopy(outputAreaNormalMorse));
nOutputMenu.add(nCopyOutput);
}
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 60a788d..968d575 100755
--- a/src/de/marcelkapfer/c/morseconverter/text.properties
+++ b/src/de/marcelkapfer/c/morseconverter/text.properties
@@ -1,5 +1,5 @@
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
+aboutUpdateAvailable=&Update available
aboutUpdateAvailableButton=Install Update
clear=Clear
copy=Copy
@@ -13,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/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() {