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 class Main extends Application {
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
try { try {
RootGridPane root = new RootGridPane(); RootGridPane root = new RootGridPane(); // BorderPane machen und wahrscheinlich FlowPane
// BorderPane root = new BorderPane(); // BorderPane root = new BorderPane();
Scene scene = new Scene(root, 400, 400); Scene scene = new Scene(root, 400, 400);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.setTitle("Erstes Fenster"); primaryStage.setTitle("GUI Übung 2");
primaryStage.show(); primaryStage.show();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -1,11 +1,8 @@
package application; package application;
import javafx.geometry.HPos;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.scene.control.RadioButton;
import javafx.geometry.VPos; import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
public class RootGridPane extends GridPane { public class RootGridPane extends GridPane {
@ -14,9 +11,7 @@ public class RootGridPane extends GridPane {
// Button btLaden; // Button btLaden;
// Button btSpeichern; // Button btSpeichern;
private Button btButton1, btLaden, btSpeichern; private RadioButton radbtLeft, radbtCenter, radbtRight;
private Button btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht;
private FlowPane fpRechtsUnten;
public RootGridPane() { public RootGridPane() {
initComponents(); initComponents();
@ -25,43 +20,24 @@ public class RootGridPane extends GridPane {
public void initComponents() { public void initComponents() {
btButton1 = new Button("Button1"); radbtLeft = new RadioButton("");
btButton1.setPrefSize(100, 100); radbtLeft.setPadding(new Insets(10));
btButton1.setAlignment(Pos.BOTTOM_RIGHT);
btLaden = new Button("Laden-Button");
btLaden.setPrefSize(200, 200);
btLaden.setAlignment(Pos.TOP_CENTER);
btSpeichern = new Button("Speichern-Button"); radbtCenter = new RadioButton("");
btSpeichern.setPrefSize(200, 200); radbtCenter.setPadding(new Insets(10));
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(); radbtRight = new RadioButton("");
fpRechtsUnten.setPrefSize(200, 200); radbtRight.setPadding(new Insets(10));
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() { public void addComponents() {
add(btButton1, 0, 0); add(radbtLeft, 0, 0);
add(btLaden, 1, 0); add(radbtCenter, 0, 0);
add(btSpeichern, 0, 1); add(radbtRight, 0, 0);
add(fpRechtsUnten, 1, 1);
fpRechtsUnten.getChildren().addAll(btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht);
} }
} }