Anchorpane

This commit is contained in:
Sage The DM 2024-10-29 09:46:04 +01:00
parent f3b770e972
commit 48a8902a52
13 changed files with 133 additions and 12 deletions

View file

@ -0,0 +1,44 @@
package com.example;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
/**
* JavaFX App with AnchorPane layout
*/
public class App extends Application {
@Override
public void start(Stage stage) {
// Create AnchorPane
AnchorPane anchorPane = new AnchorPane();
// Create Controll button
Button controlButton = new Button("Button");
AnchorPane.setTopAnchor(controlButton, 50.0);
AnchorPane.setLeftAnchor(controlButton, 50.0);
AnchorPane.setRightAnchor(controlButton, 10.0);
AnchorPane.setBottomAnchor(controlButton, 10.0);
// Create Button 1
Button button1 = new Button("Button 1");
AnchorPane.setTopAnchor(button1, 10.0);
AnchorPane.setLeftAnchor(button1, 10.0);
// Add buttons to the pane
anchorPane.getChildren().addAll(controlButton, button1);
// Set up the Scene with AnchorPane
Scene scene = new Scene(anchorPane, 640, 480);
stage.setTitle("Hauptfenster with AnchorPane");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}

View file

@ -0,0 +1,13 @@
package com.example;
public class SystemInfo {
public static String javaVersion() {
return System.getProperty("java.version");
}
public static String javafxVersion() {
return System.getProperty("javafx.version");
}
}

View file

@ -0,0 +1,4 @@
module com.example {
requires javafx.controls;
exports com.example;
}