Update to meet Google Java Coding Guidlines
This commit is contained in:
parent
280f195755
commit
85261470cc
15 changed files with 474 additions and 573 deletions
86
.idea/dictionaries/mmk2410.xml
Normal file
86
.idea/dictionaries/mmk2410.xml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<component name="ProjectDictionaryState">
|
||||||
|
<dictionary name="mmk2410">
|
||||||
|
<words>
|
||||||
|
<w>abteilung</w>
|
||||||
|
<w>affero</w>
|
||||||
|
<w>aktivieren</w>
|
||||||
|
<w>aktuelle</w>
|
||||||
|
<w>aktuellste</w>
|
||||||
|
<w>anleitung</w>
|
||||||
|
<w>aufmerksam</w>
|
||||||
|
<w>ausführliche</w>
|
||||||
|
<w>beim</w>
|
||||||
|
<w>bereinigen</w>
|
||||||
|
<w>bist</w>
|
||||||
|
<w>bitte</w>
|
||||||
|
<w>dann</w>
|
||||||
|
<w>diese</w>
|
||||||
|
<w>eine</w>
|
||||||
|
<w>einen</w>
|
||||||
|
<w>einfügen</w>
|
||||||
|
<w>entwickler</w>
|
||||||
|
<w>erfolgreich</w>
|
||||||
|
<w>fadb</w>
|
||||||
|
<w>fehlenden</w>
|
||||||
|
<w>fehlender</w>
|
||||||
|
<w>fehler</w>
|
||||||
|
<w>finden</w>
|
||||||
|
<w>fullname</w>
|
||||||
|
<w>geben</w>
|
||||||
|
<w>gefunden</w>
|
||||||
|
<w>geworden</w>
|
||||||
|
<w>herunterladen</w>
|
||||||
|
<w>hgap</w>
|
||||||
|
<w>hsize</w>
|
||||||
|
<w>hspacer</w>
|
||||||
|
<w>installieren</w>
|
||||||
|
<w>kannst</w>
|
||||||
|
<w>kontakt</w>
|
||||||
|
<w>kopieren</w>
|
||||||
|
<w>letterspace</w>
|
||||||
|
<w>lgpl</w>
|
||||||
|
<w>licensors</w>
|
||||||
|
<w>lizenz</w>
|
||||||
|
<w>marcelkapfer</w>
|
||||||
|
<w>mehr</w>
|
||||||
|
<w>möglich</w>
|
||||||
|
<w>neues</w>
|
||||||
|
<w>nich</w>
|
||||||
|
<w>nicht</w>
|
||||||
|
<w>nochmal</w>
|
||||||
|
<w>noncommercially</w>
|
||||||
|
<w>normales</w>
|
||||||
|
<w>recognization</w>
|
||||||
|
<w>relicensing</w>
|
||||||
|
<w>schließen</w>
|
||||||
|
<w>schreibe</w>
|
||||||
|
<w>scrollpane</w>
|
||||||
|
<w>später</w>
|
||||||
|
<w>starten</w>
|
||||||
|
<w>sublicenses</w>
|
||||||
|
<w>sublicensing</w>
|
||||||
|
<w>sudo</w>
|
||||||
|
<w>suppressions</w>
|
||||||
|
<w>tabbedpane</w>
|
||||||
|
<w>trat</w>
|
||||||
|
<w>trello</w>
|
||||||
|
<w>umwandler</w>
|
||||||
|
<w>verbindung</w>
|
||||||
|
<w>verfügbar</w>
|
||||||
|
<w>verfügbarr</w>
|
||||||
|
<w>versuch</w>
|
||||||
|
<w>versuchen</w>
|
||||||
|
<w>verwendest</w>
|
||||||
|
<w>verzeichniss</w>
|
||||||
|
<w>vgap</w>
|
||||||
|
<w>vsize</w>
|
||||||
|
<w>wenn</w>
|
||||||
|
<w>willst</w>
|
||||||
|
<w>wipo</w>
|
||||||
|
<w>writtenmorse</w>
|
||||||
|
<w>änderungen</w>
|
||||||
|
<w>über</w>
|
||||||
|
<w>überprüfen</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
|
</component>
|
|
@ -21,22 +21,6 @@
|
||||||
<option name="OPEN_IN_BROWSER" value="true" />
|
<option name="OPEN_IN_BROWSER" value="true" />
|
||||||
<option name="OPTION_INCLUDE_LIBS" value="false" />
|
<option name="OPTION_INCLUDE_LIBS" value="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>Android</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
<OptionsSetting value="true" id="Add" />
|
<OptionsSetting value="true" id="Add" />
|
||||||
<OptionsSetting value="true" id="Remove" />
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
@ -47,7 +31,7 @@
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
File diff suppressed because it is too large
Load diff
|
@ -145,6 +145,7 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<foreground color="-4517120"/>
|
<foreground color="-4517120"/>
|
||||||
|
<labelFor value="b553f"/>
|
||||||
<text resource-bundle="de/marcelkapfer/c/morseconverter/text" key="aboutUpdateAvailable"/>
|
<text resource-bundle="de/marcelkapfer/c/morseconverter/text" key="aboutUpdateAvailable"/>
|
||||||
<visible value="false"/>
|
<visible value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -160,4 +161,7 @@
|
||||||
</tabbedpane>
|
</tabbedpane>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
|
<inspectionSuppressions>
|
||||||
|
<suppress inspection="NoLabelFor"/>
|
||||||
|
</inspectionSuppressions>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -50,8 +50,8 @@ public class Main extends JFrame {
|
||||||
public static final int currentVersion = 200;
|
public static final int currentVersion = 200;
|
||||||
public static int latestVersion = currentVersion;
|
public static int latestVersion = currentVersion;
|
||||||
|
|
||||||
public static ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
|
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
|
||||||
public JTabbedPane morseConverterPane;
|
private JTabbedPane morseConverterPane;
|
||||||
private JPanel panel1;
|
private JPanel panel1;
|
||||||
private JTextArea inputAreaWrittenMorse;
|
private JTextArea inputAreaWrittenMorse;
|
||||||
private JTextArea outputAreaWrittenMorse;
|
private JTextArea outputAreaWrittenMorse;
|
||||||
|
@ -96,13 +96,7 @@ public class Main extends JFrame {
|
||||||
updateDialogButton.setText(resourceBundle.getString("aboutUpdateAvailableButton"));
|
updateDialogButton.setText(resourceBundle.getString("aboutUpdateAvailableButton"));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDialogButton.addActionListener(new ActionListener() {
|
updateDialogButton.addActionListener(e -> updateDialog());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
updateDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mouse listener for selecting text on left click in output text area
|
// Mouse listener for selecting text on left click in output text area
|
||||||
outputAreaWrittenMorse.addMouseListener(new MouseListener() {
|
outputAreaWrittenMorse.addMouseListener(new MouseListener() {
|
||||||
|
@ -174,23 +168,15 @@ public class Main extends JFrame {
|
||||||
|
|
||||||
// Item for paste
|
// Item for paste
|
||||||
JMenuItem pasteWInput = new JMenuItem(resourceBundle.getString("paste"));
|
JMenuItem pasteWInput = new JMenuItem(resourceBundle.getString("paste"));
|
||||||
pasteWInput.addActionListener(new ActionListener() {
|
pasteWInput.addActionListener(e -> {
|
||||||
@Override
|
onPaste(inputAreaWrittenMorse);
|
||||||
public void actionPerformed(ActionEvent e) {
|
instantWrittenMorseConvert();
|
||||||
onPaste(inputAreaWrittenMorse);
|
|
||||||
instantWrittenMorseConvert();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
wInputPopup.add(pasteWInput);
|
wInputPopup.add(pasteWInput);
|
||||||
|
|
||||||
// Item for clear
|
// Item for clear
|
||||||
JMenuItem clearWInput = new JMenuItem(resourceBundle.getString("clear"));
|
JMenuItem clearWInput = new JMenuItem(resourceBundle.getString("clear"));
|
||||||
clearWInput.addActionListener(new ActionListener() {
|
clearWInput.addActionListener(e -> clear(inputAreaWrittenMorse));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
clear(inputAreaWrittenMorse);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
wInputPopup.add(clearWInput);
|
wInputPopup.add(clearWInput);
|
||||||
|
|
||||||
// Popup Menu for writtenMorse output text field
|
// Popup Menu for writtenMorse output text field
|
||||||
|
@ -199,12 +185,7 @@ public class Main extends JFrame {
|
||||||
|
|
||||||
// Item for copy
|
// Item for copy
|
||||||
JMenuItem copyWOutput = new JMenuItem(resourceBundle.getString("copy"));
|
JMenuItem copyWOutput = new JMenuItem(resourceBundle.getString("copy"));
|
||||||
copyWOutput.addActionListener(new ActionListener() {
|
copyWOutput.addActionListener(e -> onCopy(outputAreaWrittenMorse));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCopy(outputAreaWrittenMorse);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
wOutputPopup.add(copyWOutput);
|
wOutputPopup.add(copyWOutput);
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,23 +197,15 @@ public class Main extends JFrame {
|
||||||
|
|
||||||
// Item for paste
|
// Item for paste
|
||||||
JMenuItem nPasteInput = new JMenuItem(resourceBundle.getString("paste"));
|
JMenuItem nPasteInput = new JMenuItem(resourceBundle.getString("paste"));
|
||||||
nPasteInput.addActionListener(new ActionListener() {
|
nPasteInput.addActionListener(e -> {
|
||||||
@Override
|
onPaste(inputAreaNormalMorse);
|
||||||
public void actionPerformed(ActionEvent e) {
|
instantNormalMorseConvert();
|
||||||
onPaste(inputAreaNormalMorse);
|
|
||||||
instantNormalMorseConvert();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
nInputMenu.add(nPasteInput);
|
nInputMenu.add(nPasteInput);
|
||||||
|
|
||||||
// Item for clear
|
// Item for clear
|
||||||
JMenuItem nClearInput = new JMenuItem(resourceBundle.getString("clear"));
|
JMenuItem nClearInput = new JMenuItem(resourceBundle.getString("clear"));
|
||||||
nClearInput.addActionListener(new ActionListener() {
|
nClearInput.addActionListener(e -> clear(inputAreaNormalMorse));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
clear(inputAreaNormalMorse);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nInputMenu.add(nClearInput);
|
nInputMenu.add(nClearInput);
|
||||||
|
|
||||||
// Popup for output text field
|
// Popup for output text field
|
||||||
|
@ -240,14 +213,9 @@ public class Main extends JFrame {
|
||||||
JPopupMenu nOutputMenu = new JPopupMenu();
|
JPopupMenu nOutputMenu = new JPopupMenu();
|
||||||
addPopup(outputAreaNormalMorse, nOutputMenu);
|
addPopup(outputAreaNormalMorse, nOutputMenu);
|
||||||
|
|
||||||
// Menü item for copy
|
// Menu item for copy
|
||||||
JMenuItem nCopyOutput = new JMenuItem(resourceBundle.getString("copy"));
|
JMenuItem nCopyOutput = new JMenuItem(resourceBundle.getString("copy"));
|
||||||
nCopyOutput.addActionListener(new ActionListener() {
|
nCopyOutput.addActionListener(e -> onCopy(outputAreaNormalMorse));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCopy(outputAreaNormalMorse);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nOutputMenu.add(nCopyOutput);
|
nOutputMenu.add(nCopyOutput);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class DecodeNormalMorseManager {
|
||||||
// Variables
|
// Variables
|
||||||
StringBuffer input = new StringBuffer();
|
StringBuffer input = new StringBuffer();
|
||||||
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuilder output = new StringBuilder();
|
||||||
if (input.toString().equals("LETTERSPACE")) {
|
if (input.toString().equals("LETTERSPACE")) {
|
||||||
output.replace(0, output.length(), " ");
|
output.replace(0, output.length(), " ");
|
||||||
} else if (input.toString().equals("END OF WORK")) {
|
} else if (input.toString().equals("END OF WORK")) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class DecodeWrittenMorseManager {
|
||||||
// Variables
|
// Variables
|
||||||
StringBuffer input = new StringBuffer();
|
StringBuffer input = new StringBuffer();
|
||||||
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
input = input.replace(0, input.length(), message.toString().toUpperCase());
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuilder output = new StringBuilder();
|
||||||
if (input.toString().equals("LETTERSPACE")) {
|
if (input.toString().equals("LETTERSPACE")) {
|
||||||
output.replace(0, output.length(), "#");
|
output.replace(0, output.length(), "#");
|
||||||
} else if (input.toString().equals("END OF WORK")) {
|
} else if (input.toString().equals("END OF WORK")) {
|
||||||
|
|
|
@ -38,16 +38,16 @@ public class EncodeNormalMorseManager {
|
||||||
}
|
}
|
||||||
// Declaring variables
|
// Declaring variables
|
||||||
String input;
|
String input;
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuilder output = new StringBuilder();
|
||||||
input = message.toString() + " ";
|
input = message.toString() + " ";
|
||||||
input = input.replace(System.lineSeparator(), "\n");
|
input = input.replace(System.lineSeparator(), "\n");
|
||||||
input = input.replace("\r", "\n");
|
input = input.replace("\r", "\n");
|
||||||
input = input.replace("\r\n", "\n");
|
input = input.replace("\r\n", "\n");
|
||||||
StringBuffer inputToSign = new StringBuffer(input);
|
StringBuilder inputToSign = new StringBuilder(input);
|
||||||
while (!inputToSign.toString().equals(" ")) {
|
while (!inputToSign.toString().equals(" ")) {
|
||||||
int d = 0;
|
int d = 0;
|
||||||
boolean signFull = true;
|
boolean signFull = true;
|
||||||
StringBuffer sign = new StringBuffer();
|
StringBuilder sign = new StringBuilder();
|
||||||
while (signFull) {
|
while (signFull) {
|
||||||
if (inputToSign.toString().startsWith(" ")) {
|
if (inputToSign.toString().startsWith(" ")) {
|
||||||
output.append(" ");
|
output.append(" ");
|
||||||
|
|
|
@ -37,16 +37,16 @@ public class EncodeWrittenMorseManager {
|
||||||
}
|
}
|
||||||
// Variables
|
// Variables
|
||||||
String input;
|
String input;
|
||||||
StringBuffer output = new StringBuffer();
|
StringBuilder output = new StringBuilder();
|
||||||
input = message.toString().toUpperCase() + "#";
|
input = message.toString().toUpperCase() + "#";
|
||||||
input = input.replace(System.lineSeparator(), "\n");
|
input = input.replace(System.lineSeparator(), "\n");
|
||||||
input = input.replace("\r", "\n");
|
input = input.replace("\r", "\n");
|
||||||
input = input.replace("\r\n", "\n");
|
input = input.replace("\r\n", "\n");
|
||||||
StringBuffer inputToSign = new StringBuffer(input);
|
StringBuilder inputToSign = new StringBuilder(input);
|
||||||
while (!inputToSign.toString().equals("#")) {
|
while (!inputToSign.toString().equals("#")) {
|
||||||
int d = 0;
|
int d = 0;
|
||||||
boolean signFull = true;
|
boolean signFull = true;
|
||||||
StringBuffer sign = new StringBuffer();
|
StringBuilder sign = new StringBuilder();
|
||||||
while (signFull) {
|
while (signFull) {
|
||||||
if (inputToSign.toString().charAt(d) == '+'
|
if (inputToSign.toString().charAt(d) == '+'
|
||||||
|| inputToSign.toString().charAt(d) == '#'
|
|| inputToSign.toString().charAt(d) == '#'
|
||||||
|
|
|
@ -22,13 +22,14 @@ package de.marcelkapfer.c.morseconverter.intelligentCodeRecognization;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mmk on 5/31/15.
|
* Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* Licensed under
|
||||||
*/
|
*/
|
||||||
public class NormalMorseCodeRecognization {
|
public class NormalMorseCodeRecognization {
|
||||||
|
|
||||||
public static Boolean isCode(String input){
|
public static Boolean isCode(String input){
|
||||||
input = input.toLowerCase();
|
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("c") || input.contains("d") ||
|
||||||
input.contains("e") || input.contains("f") ||
|
input.contains("e") || input.contains("f") ||
|
||||||
input.contains("g") || input.contains("h") ||
|
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(")") ||
|
||||||
input.contains("=") || input.contains("/") ||
|
input.contains("=") || input.contains("/") ||
|
||||||
input.contains("@") || input.contains("'")){
|
input.contains("@") || input.contains("'"));
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,14 @@ package de.marcelkapfer.c.morseconverter.intelligentCodeRecognization;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mmk on 5/31/15.
|
* Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
|
||||||
|
* Licensed under
|
||||||
*/
|
*/
|
||||||
public class WrittenMorseCodeRecognization {
|
public class WrittenMorseCodeRecognization {
|
||||||
|
|
||||||
public static Boolean isCode(String input){
|
public static Boolean isCode(String input){
|
||||||
input = input.toLowerCase();
|
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("c") || input.contains("d") ||
|
||||||
input.contains("e") || input.contains("f") ||
|
input.contains("e") || input.contains("f") ||
|
||||||
input.contains("g") || input.contains("h") ||
|
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("=") || input.contains("/") ||
|
||||||
input.contains("@") || input.contains("'") ||
|
input.contains("@") || input.contains("'") ||
|
||||||
input.contains("$")){
|
input.contains("$"));
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
about=<body style\="font-family\: sans-serif">\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Version</b><br>2.0.0\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Developer</b><br>Marcel Michael Kapfer\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Website</b><br>marcel-kapfer.de/writtenmorse\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Contact</b><br>marcelmichaelkapfer@yahoo.co.nz\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>License</b><br>GNU GPL v3.0\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Bug</b><br>If you found a bug, please write me a mail to marcelmichaelkapfer@yahoo.co.nz with a short description of the problem.\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>How to</b><br>You can find a detailed guide on marcel-kapfer.de/writtenmorse/\#howto_desktop\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Missing Code</b><br>If you discovered, that a code is missing, then write me a mail to marcelmichaelkapfer@yahoo.co.nz and tell me about it.\n</p>\n</p>\n</body>
|
about=<body style\="font-family\: sans-serif">\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Version</b><br>2.0.0\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Developer</b><br>Marcel Michael Kapfer\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Website</b><br>marcel-kapfer.de/writtenmorse\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Contact</b><br>marcelmichaelkapfer@yahoo.co.nz\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>License</b><br>GNU GPL v3.0\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Bug</b><br>If you found a bug, please write me a mail to marcelmichaelkapfer@yahoo.co.nz with a short description of the problem.\n</p>\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>How to</b><br>You can find a detailed guide on marcel-kapfer.de/writtenmorse/\#howto_desktop\n<p style\="margin-top\: 5px; margin-right\: 5px; margin-bottom\: 5px; margin-left\: 5px">\n<b>Missing Code</b><br>If you discovered, that a code is missing, then write me a mail to marcelmichaelkapfer@yahoo.co.nz and tell me about it.\n</p>\n</p>\n</body>
|
||||||
aboutUpdateAvailable=Update available
|
aboutUpdateAvailable=&Update available
|
||||||
aboutUpdateAvailableButton=Install Update
|
aboutUpdateAvailableButton=Install Update
|
||||||
clear=Clear
|
clear=Clear
|
||||||
copy=Copy
|
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-not-successful=Update not successful
|
||||||
update-successful=Update successful.\nPlease restart the software to activate the changes.
|
update-successful=Update successful.\nPlease restart the software to activate the changes.
|
||||||
updateAvailable=An Update is available\!\nGo to the 'About' section for more.
|
updateAvailable=An Update is available\!\nGo to the 'About' section for more.
|
||||||
updateButton=Check for updates
|
updateButton=&Check for updates
|
||||||
updateDialogClose=Close
|
updateDialogClose=Close
|
||||||
updateDialogNewVersion=A new version of the Morse Converter is available.
|
updateDialogNewVersion=A new version of the Morse Converter is available.
|
||||||
updateDialogUpToDateText=You're running the latest version.
|
updateDialogUpToDateText=You're running the latest version.
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Update {
|
||||||
* Argument: The URL of the file with the version number as a string
|
* 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 {
|
try {
|
||||||
update = new URL(url);
|
update = new URL(url);
|
||||||
update.openStream();
|
update.openStream();
|
||||||
|
@ -57,7 +57,7 @@ public class Update {
|
||||||
* Arguments: The path where the jar file is located, the name of the jar file
|
* 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 {
|
try {
|
||||||
ReadableByteChannel updateChannel = Channels.newChannel(update.openStream());
|
ReadableByteChannel updateChannel = Channels.newChannel(update.openStream());
|
||||||
FileOutputStream updateOutputStream = new FileOutputStream(path + filename);
|
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
|
* 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){
|
public static int getLatestVersion(String versionFile){
|
||||||
return getLatestVersion(versionFile, 0);
|
return getLatestVersion(versionFile, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="10" left="10" bottom="10" right="10"/>
|
<margin top="10" left="10" bottom="10" right="10"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="48" y="54" width="551" height="297"/>
|
<xy x="48" y="54" width="720" height="297"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Yes"/>
|
<text value="&Yes"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
|
<component id="5723f" class="javax.swing.JButton" binding="buttonCancel">
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="No"/>
|
<text value="&No"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -32,13 +32,13 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class UpdateDialog extends JDialog {
|
public class UpdateDialog extends JDialog {
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
public JButton buttonOK;
|
private JButton buttonOK;
|
||||||
public JButton buttonCancel;
|
private JButton buttonCancel;
|
||||||
public JLabel updateDialogQuestion;
|
private JLabel updateDialogQuestion;
|
||||||
public JLabel updateDialogNewVersion;
|
private JLabel updateDialogNewVersion;
|
||||||
private ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
|
private final ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text");
|
||||||
|
|
||||||
public UpdateDialog() {
|
private UpdateDialog() {
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
getRootPane().setDefaultButton(buttonOK);
|
getRootPane().setDefaultButton(buttonOK);
|
||||||
|
@ -48,17 +48,9 @@ public class UpdateDialog extends JDialog {
|
||||||
updateDialogNewVersion.setVisible(false);
|
updateDialogNewVersion.setVisible(false);
|
||||||
updateDialogQuestion.setText(resourceBundle.getString("updateDialogUpToDateText"));
|
updateDialogQuestion.setText(resourceBundle.getString("updateDialogUpToDateText"));
|
||||||
}
|
}
|
||||||
buttonOK.addActionListener(new ActionListener() {
|
buttonOK.addActionListener(e -> onOK());
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onOK();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonCancel.addActionListener(new ActionListener() {
|
buttonCancel.addActionListener(e -> onCancel());
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// call onCancel() when cross is clicked
|
// call onCancel() when cross is clicked
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
|
@ -69,11 +61,7 @@ public class UpdateDialog extends JDialog {
|
||||||
});
|
});
|
||||||
|
|
||||||
// call onCancel() on ESCAPE
|
// call onCancel() on ESCAPE
|
||||||
contentPane.registerKeyboardAction(new ActionListener() {
|
contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCancel();
|
|
||||||
}
|
|
||||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onOK() {
|
private void onOK() {
|
||||||
|
|
Reference in a new issue