Flow Pane

This commit is contained in:
FUH22860 2022-05-03 11:51:53 +02:00
parent bf4bac33a9
commit a6a960bb42
2 changed files with 69 additions and 38 deletions

View File

@ -3,21 +3,30 @@ package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
//import javafx.scene.layout.BorderPane;
public class Main extends Application {
public void start(Stage primaryStage) {
try {
public class Main extends Application
{
public void start(Stage primaryStage)
{
try
{
RootGridPane root = new RootGridPane();
// BorderPane root = new BorderPane();
Scene scene = new Scene(root, 400, 400);
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setTitle("Erstes Fenster");
} catch (Exception e) {
primaryStage.show();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
public static void main(String[] args)
{
launch(args);
}
}

View File

@ -1,31 +1,53 @@
package application;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
public class RootGridPane extends GridPane {
Button btButton1, btLaden, btSpeichern; // Main Buttons
Button btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht; // FlowPane
// Button btButton1;
// Button btLaden;
// Button btSpeichern;
public RootGridPane() {
Button btButton1, btLaden, btSpeichern;
Button btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht;
FlowPane fpRechtsUnten ;
public RootGridPane()
{
initComponents();
addComponents();
}
public void initComponents() {
btButton1 = new Button("Button1");
btButton1.setPrefSize(200, 200);
btLaden = new Button("Laden-Button");
btLaden.setPrefSize(200, 200);
btSpeichern = new Button("Speichern-Button");
btSpeichern.setPrefSize(200, 200);
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);
}
public void addComponents() {
add(btButton1, 0, 0);
add(btSpeichern, 0, 1);
add(btLaden, 1, 0);
add(btSpeichern, 0, 1);
add(fpRechtsUnten, 1, 1);
fpRechtsUnten.getChildren().addAll(btButton4, btButton5, btButton6, btButtonSieben, btButtonAcht);
}
}