Compare commits

...

2 Commits

Author SHA1 Message Date
8e8eb3a3e3 Zusammenführung ClickEvents 2021-11-25 14:36:03 +01:00
882baf19af ClickEvent StartButton 2021-11-25 14:32:39 +01:00
11 changed files with 69 additions and 6 deletions

View File

@ -7,10 +7,4 @@
<StackPane prefHeight="800.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.happy_bird.HappyBird" back > <StackPane prefHeight="800.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.happy_bird.HappyBird" back >
<ImageView>
<image>
<Image url="@pics/Background.png"></Image>
</image>
</ImageView>
</StackPane> </StackPane>

View File

@ -9,6 +9,7 @@ import javafx.geometry.Pos;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Slider; import javafx.scene.control.Slider;
import javafx.scene.image.*; import javafx.scene.image.*;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -68,6 +69,9 @@ public class HappyBirdMain extends Application {
Button startButton = new Button("START"); Button startButton = new Button("START");
Button highscoresButton = new Button("HIGHSCORES"); Button highscoresButton = new Button("HIGHSCORES");
Button settingsButton = new Button("EINSTELLUNGEN"); Button settingsButton = new Button("EINSTELLUNGEN");
Button spielStarten = new Button("SPIEL STARTEN");
Button buttons[] = {startButton, highscoresButton, settingsButton, spielStarten};
Button menuButton = new Button("ZURÜCK"); Button menuButton = new Button("ZURÜCK");
menuButton.setStyle("-fx-background-color: #e86000; " + menuButton.setStyle("-fx-background-color: #e86000; " +
"-fx-text-fill: #FFFFFF; " + "-fx-text-fill: #FFFFFF; " +
@ -103,6 +107,68 @@ public class HappyBirdMain extends Application {
"-fx-background-radius: 20px;"); "-fx-background-radius: 20px;");
} }
spielStarten.setVisible(false);
startButton.setOnAction(event -> {
headline.setText("Start");
for(Button button : buttons) {
button.setVisible(false);
}
Label nameLabel = new Label("Name:");
Label acronymLabel = new Label("Kürzel:");
Label startLabels[] = {nameLabel, acronymLabel};
int yPositionStartLabels = 225;
for(Label label : startLabels) {
label.setPrefSize(250, 50);
label.setStyle("-fx-background-color: #DED894; " +
"-fx-text-fill: #000000; " +
"-fx-font-size: 20px; " +
"-fx-border-width: 5px;" +
"-fx-border-color: #543847;" +
"-fx-font-weight: bold;" +
"-fx-alignment: center;" +
"-fx-background-radius: 20px;" +
"-fx-border-radius: 15px;");
label.setLayoutX(275);
label.setLayoutY(yPositionStartLabels);
yPositionStartLabels += 150;
pane.getChildren().add(label);
}
TextField name = new TextField();
TextField acronym = new TextField();
TextField inputFields[] = {name, acronym};
int yPositionInputFields = 290;
for(TextField feld : inputFields) {
feld.setPrefSize(250, 50);
feld.setStyle("-fx-font-size: 20px;" +
"-fx-font-weight: bold;");
feld.setLayoutX(275);
feld.setLayoutY(yPositionInputFields);
yPositionInputFields += 150;
pane.getChildren().add(feld);
}
spielStarten.setVisible(true);
spielStarten.setLayoutY(520);
});
startButton.setOnAction(event -> {});
//Slider: //Slider:
Slider soundSlider = new Slider(); Slider soundSlider = new Slider();
pane.getChildren().add(soundSlider); pane.getChildren().add(soundSlider);

View File

@ -7,10 +7,13 @@
<StackPane prefHeight="800.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.happy_bird.HappyBird" back > <StackPane prefHeight="800.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.happy_bird.HappyBird" back >
<<<<<<< HEAD
=======
<ImageView> <ImageView>
<image> <image>
<Image url="@pics/Background.png"></Image> <Image url="@pics/Background.png"></Image>
</image> </image>
</ImageView> </ImageView>
>>>>>>> 5db5b6bb195a2b7d1296e7d3f9b98d6c75dba2c2
</StackPane> </StackPane>