Skip to content
Snippets Groups Projects
Commit a4cb5dfe authored by Jan Schubert's avatar Jan Schubert
Browse files

KenngruppeController

parent 73b9f074
No related branches found
No related tags found
1 merge request!91Master
......@@ -18,22 +18,27 @@ public class KenngruppeController {
* Beim drücken der Taste wird überprüft ob die eingegebene Kenngruppe weniger als 9 Zeichen hat und ob die
* eingegebenen Zeichen nur Buchstaben sind.
* Bei einer gültigen Eingabe wird die eingegebene Kenngruppe gespeichert und die Enigma-Anwendung gestartet
*
* @throws IOException :
*/
@FXML
private void btnGui() throws IOException {
if (tfKenngruppe.getText().length() <9) {
for (char c : tfKenngruppe.getText().toCharArray()) {
if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f' || c == 'g' || c == 'h' || c == 'i' || c == 'j' || c == 'k' || c == 'l' || c == 'm' || c == 'n' || c == 'o' || c == 'p' || c == 'q' || c == 'r' || c == 's' || c == 't' || c == 'u' || c == 'v' || c == 'w' || c == 'x' || c == 'y' || c == 'z'||c == 'A' || c == 'B' || c == 'C' || c == 'D' || c == 'E' || c == 'F' || c == 'G' || c == 'H' || c == 'I' || c == 'J' || c == 'K' || c == 'L' || c == 'M' || c == 'N' || c == 'O' || c == 'P' || c == 'Q' || c == 'R' || c == 'S' || c == 'T' || c == 'U' || c == 'V' || c == 'W' || c == 'X' || c == 'Y' || c == 'Z') {
cod.setKenngruppe(tfKenngruppe.getText());
//setzt
App.setRoot("gui");
}
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
boolean error = false;
for (char c : tfKenngruppe.getText().toUpperCase().toCharArray()) {
if (!alphabet.contains(String.valueOf(c))) {
error = true;
}
}
if (tfKenngruppe.getText().length() < 9 && !error) {
cod.setKenngruppe(tfKenngruppe.getText().toUpperCase());
//setzt
// App.setRoot("gui");
} else {
tfKenngruppe.setStyle("-fx-background-color:#FF0000");
tfKenngruppe.setText("Fehlerhafte Kenngruppe!");
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment