Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Enigma
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flori N
Enigma
Commits
f2a37ab4
Commit
f2a37ab4
authored
5 years ago
by
Flori N
Browse files
Options
Downloads
Patches
Plain Diff
Doku & Code Conventionen App
parent
00aabc0c
Branches
master
No related tags found
No related merge requests found
Pipeline
#408
passed with stages
in 1 minute and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/projekt/enigma/App.java
+36
-2
36 additions, 2 deletions
src/main/java/projekt/enigma/App.java
with
36 additions
and
2 deletions
src/main/java/projekt/enigma/App.java
+
36
−
2
View file @
f2a37ab4
...
...
@@ -19,18 +19,42 @@ import java.io.IOException;
*/
public
class
App
extends
Application
{
/**
* Deklariert den GuiController
*/
private
static
GuiController
gc
;
/**
* debug : int : fuer die Funktion debug der Klasse Fehler notwendig
*/
private
static
int
debug
;
/**
* Startet die Klasse App und setzt den debug-Wert 1
*
* @param args : String[] : Standard-Kommandozeilen-Argument
*/
public
static
void
main
(
String
[]
args
)
{
debug
=
1
;
launch
(
args
);
}
/**
* gibt der Getter einen int > 0 zurueck, wird eine Meldung auf der Konsole ausgegeben
*
* @return debug : int : bestimmt die Eingabe der debung-Methode in der Klasse Fehler
*/
public
static
int
getDebug
()
{
return
debug
;
}
/**
* Initialisieren der Variablen fuer die JavaFX Scene Kenngruppe.
* Abfrage der Kenngruppe und Reaktion auf die Eingabe.
*
* @param primaryStage : Stage : Fenster zur Eingabe der Kenngruppe
* @throws IOException : wird bei fehlerhafter Eingabe geworfen
*/
@Override
public
void
start
(
Stage
primaryStage
)
throws
IOException
{
primaryStage
.
setTitle
(
"Enigma"
);
...
...
@@ -42,12 +66,16 @@ public class App extends Application {
layout
.
setPadding
(
new
Insets
(
30
,
30
,
30
,
30
));
btnKenngruppe
.
setMaxWidth
(
Double
.
MAX_VALUE
);
// baut die Scene fuer die Kenngruppenabfrage auf
layout
.
getChildren
().
addAll
(
lblEingbae
,
tfEingabe
,
btnKenngruppe
);
Scene
sceKenngruppe
=
new
Scene
(
layout
);
// laden der FXML und der Ansicht, um Ladezeiten zu verringern
FXMLLoader
guiLoader
=
new
FXMLLoader
(
App
.
class
.
getResource
(
"gui.fxml"
));
Scene
sceApp
=
new
Scene
(
guiLoader
.
load
(),
962
,
677
);
/*Bestaetigen der Kenngruppe, Ausgabe einer Fehlermeldung im Fall einer falschen Eingabe und starten
des Enigma-Fensters */
tfEingabe
.
setOnKeyPressed
(
e
->
{
if
(
e
.
getCode
()
==
KeyCode
.
ENTER
)
{
if
(
enter
(
tfEingabe
.
getText
()))
{
...
...
@@ -76,8 +104,14 @@ public class App extends Application {
primaryStage
.
show
();
}
/**
* Ueberprueft die Gueltigkeit der Kenngruppeneingabe.
* Nur Zeichen von A-Z sind zugelassen und die Kenngruppe muss aus mind. 4 und max. 8 Zeichen bestehen.
*
* @param kenngruppe : String : Eingabewert aus dem Fenster
* @return result : boolean : ist die Kenngruppe ungueltig wird false zurueckgegeben, sonst true
*/
private
boolean
enter
(
String
kenngruppe
)
{
String
alphabet
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
boolean
result
=
true
;
...
...
@@ -87,7 +121,7 @@ public class App extends Application {
break
;
}
}
if
(
kenngruppe
.
length
()
>
8
||
kenngruppe
.
length
()
<
4
)
{
if
(
(
kenngruppe
.
length
()
>
8
)
||
(
kenngruppe
.
length
()
<
4
)
)
{
result
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment