05.08.2020
This commit is contained in:
parent
229204b417
commit
f82b847a7b
|
@ -102,27 +102,26 @@ public class Main extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the letter from Textfield
|
// Check the letter from Textfield
|
||||||
public boolean letterCheck(char[] wortToArr, char[] displayWord) {
|
public boolean arrayMatch(char[] wortToArr, char[] displayWord) {
|
||||||
|
boolean result = false;
|
||||||
for (int i = 0; i < wort.length(); i++) {
|
if(!letter.getText().isEmpty()) {
|
||||||
if (letter.getText().isEmpty() == false) {
|
for (int i = 0; i < wortToArr.length; i++) {
|
||||||
if (wortToArr[i] == letter.getText().toLowerCase().charAt(0)
|
if(wortToArr[i] == letter.getText().toLowerCase().charAt(0)
|
||||||
|| wortToArr[i] == letter.getText().toUpperCase().charAt(0)) {
|
|| wortToArr[i] == letter.getText().toUpperCase().charAt(0)) {
|
||||||
displayWord[i] = wortToArr[i];
|
displayWord[i] = wortToArr[i];
|
||||||
return true;
|
result = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm\check typed Letter
|
// Confirm\check typed Letter
|
||||||
public void checkLetter() {
|
public void verifyTypedLetter() {
|
||||||
info.setText("");
|
info.setText("");
|
||||||
|
|
||||||
if (letterCheck(wortToArr, displayWord) == true) {
|
if (arrayMatch(wortToArr, displayWord)) {
|
||||||
rightletterString = new String(displayWord);
|
rightletterString = new String(displayWord);
|
||||||
hangmanWord.setText(rightletterString);
|
hangmanWord.setText(rightletterString);
|
||||||
info.setText("Richtig");
|
info.setText("Richtig");
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<effect>
|
<effect>
|
||||||
<Bloom threshold="0.0" />
|
<Bloom threshold="0.0" />
|
||||||
</effect></ImageView>
|
</effect></ImageView>
|
||||||
<TextField fx:id="letter" disable="true" layoutX="37.0" layoutY="298.0" onKeyReleased="#checkLetter" prefHeight="72.0" prefWidth="82.0" promptText="...">
|
<TextField fx:id="letter" disable="true" layoutX="37.0" layoutY="298.0" onKeyReleased="#verifyTypedLetter" prefHeight="72.0" prefWidth="82.0" promptText="...">
|
||||||
<font>
|
<font>
|
||||||
<Font size="41.0" />
|
<Font size="41.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user