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
Michael
Enigma
Commits
064060e0
Commit
064060e0
authored
5 years ago
by
Uli Bähr
Browse files
Options
Downloads
Patches
Plain Diff
Klassenvariablen eingeführt, MenuButton Variablen umbenannt
parent
56e2be98
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/Enigma/GuiController.java
+60
-50
60 additions, 50 deletions
src/main/java/Enigma/GuiController.java
with
60 additions
and
50 deletions
src/main/java/Enigma/GuiController.java
+
60
−
50
View file @
064060e0
...
@@ -2,48 +2,46 @@ package Enigma;
...
@@ -2,48 +2,46 @@ package Enigma;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXML
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.MenuButton
;
import
javafx.scene.control.MenuButton
;
import
javafx.scene.control.MenuItem
;
import
javafx.scene.control.MenuItem
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.KeyEvent
;
import
java.beans.EventHandler
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
GuiController
{
public
class
GuiController2
{
private
ArrayList
<
MenuItem
>
mItem
;
private
final
static
String
[]
str
=
{
"I"
,
"II"
,
"III"
,
"IV"
,
"V"
};
private
final
static
String
[]
num
={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
};
private
final
static
String
[]
bs
={
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
@FXML
@FXML
private
MenuButton
w
1
;
private
MenuButton
mBtnWalzPos
1
;
@FXML
@FXML
private
MenuButton
w
2
;
private
MenuButton
mBtnWalzPos
2
;
@FXML
@FXML
private
MenuButton
w
3
;
private
MenuButton
mBtnWalzPos
3
;
@FXML
@FXML
private
MenuButton
r
1
;
private
MenuButton
mBtnNotchPos
1
;
@FXML
@FXML
private
MenuButton
r
2
;
private
MenuButton
mBtnNotchPos
2
;
@FXML
@FXML
private
MenuButton
r
3
;
private
MenuButton
mBtnNotchPos
3
;
@FXML
@FXML
private
MenuButton
a
1
;
private
MenuButton
mBtnStartPos
1
;
@FXML
@FXML
private
MenuButton
a3
;
private
MenuButton
mBtnStartPos2
;
@FXML
@FXML
private
MenuButton
a2
;
private
MenuButton
mBtnStartPos3
;
@FXML
@FXML
private
Button
L
;
private
Button
L
;
...
@@ -132,7 +130,7 @@ public class GuiController {
...
@@ -132,7 +130,7 @@ public class GuiController {
// public void gedrueckteTaste() {
// public void gedrueckteTaste() {
// txt.setText("hello");
// txt.setText("hello");
// }
// }
// public void action(ActionEvent ae){
// public void action(ActionEvent ae){
// if (ae.getSource()==)
// if (ae.getSource()==)
// }
// }
...
@@ -149,12 +147,12 @@ public class GuiController {
...
@@ -149,12 +147,12 @@ public class GuiController {
// txtoriginal.setText(bn.getText());
// txtoriginal.setText(bn.getText());
// }
// }
// public void gedrueckteTaste(Button bn){
// public void gedrueckteTaste(Button bn){
// }
// }
...
@@ -179,9 +177,6 @@ public class GuiController {
...
@@ -179,9 +177,6 @@ public class GuiController {
}
}
/**
/**
* Methode zum setzen des menuButton Textes auf das ausgewählte MenuItem
* Methode zum setzen des menuButton Textes auf das ausgewählte MenuItem
* @param mb : MenuButton der Walze
* @param mb : MenuButton der Walze
...
@@ -196,17 +191,17 @@ public class GuiController {
...
@@ -196,17 +191,17 @@ public class GuiController {
* @param button : Button für die die Einträge erstellt werden sollen
* @param button : Button für die die Einträge erstellt werden sollen
*/
*/
private
void
menu
(
MenuButton
button
,
String
[]
str
)
{
private
void
menu
(
MenuButton
button
,
String
[]
str
)
{
ArrayList
<
MenuItem
>
mi
=
new
ArrayList
<>();
mItem
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
str
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
str
.
length
;
i
++)
{
//Eintrag aus str der Arraylist mi hinzufügen
//Eintrag aus str der Arraylist mi hinzufügen
m
i
.
add
(
new
MenuItem
(
str
[
i
]));
m
Item
.
add
(
new
MenuItem
(
str
[
i
]));
//MenuItem mi dem Button button hinzufügen
//MenuItem mi dem Button button hinzufügen
button
.
getItems
().
add
(
m
i
.
get
(
i
));
button
.
getItems
().
add
(
m
Item
.
get
(
i
));
int
finalI
=
i
;
int
finalI
=
i
;
//Listener für die einzelnen Einträge
//Listener für die einzelnen Einträge
ArrayList
<
MenuItem
>
finalMi
=
m
i
;
ArrayList
<
MenuItem
>
finalMi
=
m
Item
;
m
i
.
get
(
i
).
setOnAction
(
e
->
{
m
Item
.
get
(
i
).
setOnAction
(
e
->
{
listener
(
button
,
finalMi
.
get
(
finalI
));
listener
(
button
,
finalMi
.
get
(
finalI
));
});
});
}
}
...
@@ -215,22 +210,18 @@ public class GuiController {
...
@@ -215,22 +210,18 @@ public class GuiController {
private
Button
löschen
;
private
Button
löschen
;
@FXML
@FXML
void
initialize
()
{
void
initialize
()
{
String
[]
str
={
"I"
,
"II"
,
"III"
,
"IV"
,
"V"
};
String
[]
num
={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
};
String
[]
bs
={
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
};
//Einträge für Walzen
//Einträge für Walzen
menu
(
w
1
,
str
);
menu
(
mBtnWalzPos
1
,
str
);
menu
(
w
2
,
str
);
menu
(
mBtnWalzPos
2
,
str
);
menu
(
w
3
,
str
);
menu
(
mBtnWalzPos
3
,
str
);
//Einträge für die Ringe
//Einträge für die Ringe
menu
(
r
1
,
num
);
menu
(
mBtnNotchPos
1
,
num
);
menu
(
r
2
,
num
);
menu
(
mBtnNotchPos
2
,
num
);
menu
(
r
3
,
num
);
menu
(
mBtnNotchPos
3
,
num
);
//Einträge für die Startpositionen
//Einträge für die Startpositionen
menu
(
a
1
,
bs
);
menu
(
mBtnStartPos
1
,
bs
);
menu
(
a2
,
bs
);
menu
(
mBtnStartPos3
,
bs
);
menu
(
a3
,
bs
);
menu
(
mBtnStartPos2
,
bs
);
assert
L
!=
null
:
"fx:id=\"L\" was not injected: check your FXML file 'gui.fxml'."
;
assert
L
!=
null
:
"fx:id=\"L\" was not injected: check your FXML file 'gui.fxml'."
;
assert
P
!=
null
:
"fx:id=\"P\" was not injected: check your FXML file 'gui.fxml'."
;
assert
P
!=
null
:
"fx:id=\"P\" was not injected: check your FXML file 'gui.fxml'."
;
...
@@ -259,15 +250,34 @@ public class GuiController {
...
@@ -259,15 +250,34 @@ public class GuiController {
assert
I
!=
null
:
"fx:id=\"I\" was not injected: check your FXML file 'gui.fxml'."
;
assert
I
!=
null
:
"fx:id=\"I\" was not injected: check your FXML file 'gui.fxml'."
;
assert
O
!=
null
:
"fx:id=\"O\" was not injected: check your FXML file 'gui.fxml'."
;
assert
O
!=
null
:
"fx:id=\"O\" was not injected: check your FXML file 'gui.fxml'."
;
assert
löschen
!=
null
:
"fx:id=\"löschen\" was not injected: check your FXML file 'gui.fxml'."
;
assert
löschen
!=
null
:
"fx:id=\"löschen\" was not injected: check your FXML file 'gui.fxml'."
;
assert
w
1
!=
null
:
"fx:id=\"w1\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnWalzPos
1
!=
null
:
"fx:id=\"w1\" was not injected: check your FXML file 'gui.fxml'."
;
assert
w
3
!=
null
:
"fx:id=\"w3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnWalzPos
3
!=
null
:
"fx:id=\"w3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
w
2
!=
null
:
"fx:id=\"w2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnWalzPos
2
!=
null
:
"fx:id=\"w2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
r
3
!=
null
:
"fx:id=\"r3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnNotchPos
3
!=
null
:
"fx:id=\"r3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
r
2
!=
null
:
"fx:id=\"r2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnNotchPos
2
!=
null
:
"fx:id=\"r2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
a
1
!=
null
:
"fx:id=\"a1\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnStartPos
1
!=
null
:
"fx:id=\"a1\" was not injected: check your FXML file 'gui.fxml'."
;
assert
a3
!=
null
:
"fx:id=\"a3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnStartPos2
!=
null
:
"fx:id=\"a3\" was not injected: check your FXML file 'gui.fxml'."
;
assert
a2
!=
null
:
"fx:id=\"a2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnStartPos3
!=
null
:
"fx:id=\"a2\" was not injected: check your FXML file 'gui.fxml'."
;
assert
r
1
!=
null
:
"fx:id=\"r1\" was not injected: check your FXML file 'gui.fxml'."
;
assert
mBtnNotchPos
1
!=
null
:
"fx:id=\"r1\" was not injected: check your FXML file 'gui.fxml'."
;
}
}
/**
* Setzt die Anzeige des entsprechende Gui-Element auf die entsprechende Walze
*
* @param walze => gibt die Walzennummer an (entspricht
* @param position => gibt die Position der Walze (entspricht
*/
public
void
setzeWalze
(
int
walze
,
int
position
){
switch
(
position
){
case
1
:
mBtnWalzPos1
.
setText
();
break
;
case
2
:
break
;
case
3
:
break
;
}
}
}
}
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