This commit is contained in:
FUH22860 2022-05-03 13:19:37 +02:00
parent b9f8238340
commit 05194000c1
2 changed files with 18 additions and 42 deletions

View File

@ -8,11 +8,11 @@ import javafx.scene.Scene;
public class Main extends Application {
public void start(Stage primaryStage) {
try {
RootGridPane root = new RootGridPane();
RootGridPane root = new RootGridPane(); // BorderPane machen und wahrscheinlich FlowPane
// BorderPane root = new BorderPane();
Scene scene = new Scene(root, 400, 400);
primaryStage.setScene(scene);
primaryStage.setTitle("Erstes Fenster");
primaryStage.setTitle("GUI Übung 2");
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();

View File

@ -1,11 +1,8 @@
package application;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;
public class RootGridPane extends GridPane {
@ -14,9 +11,7 @@ public class RootGridPane extends GridPane {
// Button btLaden;
// Button btSpeichern;
private Button btButton1, btLaden, btSpeichern;
private Button btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht;
private FlowPane fpRechtsUnten;
private RadioButton radbtLeft, radbtCenter, radbtRight;
public RootGridPane() {
initComponents();
@ -24,44 +19,25 @@ public class RootGridPane extends GridPane {
}
public void initComponents() {
btButton1 = new Button("Button1");
btButton1.setPrefSize(100, 100);
btButton1.setAlignment(Pos.BOTTOM_RIGHT);
radbtLeft = new RadioButton("");
radbtLeft.setPadding(new Insets(10));
radbtCenter = new RadioButton("");
radbtCenter.setPadding(new Insets(10));
btLaden = new Button("Laden-Button");
btLaden.setPrefSize(200, 200);
btLaden.setAlignment(Pos.TOP_CENTER);
radbtRight = new RadioButton("");
radbtRight.setPadding(new Insets(10));
btSpeichern = new Button("Speichern-Button");
btSpeichern.setPrefSize(200, 200);
btSpeichern.setAlignment(Pos.BOTTOM_LEFT);
btButton4 = new Button("Button vier");
btButton5 = new Button("Button5");
btButton6 = new Button("Button 6");
btButtonSieben = new Button("Button sieben");
btButtonAcht = new Button("Button acht");
fpRechtsUnten = new FlowPane();
fpRechtsUnten.setPrefSize(200, 200);
fpRechtsUnten.setAlignment(Pos.CENTER_LEFT);
fpRechtsUnten.setPadding(new Insets(10));
fpRechtsUnten.setHgap(10);
fpRechtsUnten.setVgap(10);
GridPane.setHalignment(btButton1, HPos.CENTER);
GridPane.setValignment(btButton1, VPos.BOTTOM);
}
public void addComponents() {
add(btButton1, 0, 0);
add(btLaden, 1, 0);
add(btSpeichern, 0, 1);
add(fpRechtsUnten, 1, 1);
fpRechtsUnten.getChildren().addAll(btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht);
add(radbtLeft, 0, 0);
add(radbtCenter, 0, 0);
add(radbtRight, 0, 0);
}
}