JavaFx单行面板

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class App14_6 extends Application {

    Button bt1 = new Button("上一步");
    Button bt2 = new Button("下一步");

    @Override
    public void start(Stage primaryStage) {

        // 创建单行面板对象hB
        HBox hB = new HBox();
        bt1.setPrefSize(160, 20);
        hB.setMargin(bt1, new Insets(5, 5, 5, 5));
        hB.setMargin(bt2, new Insets(10));
        bt2.setPrefSize(80, 20);
        hB.getChildren().addAll(bt1, bt2);

        Scene scene = new Scene(hB, 300, 50);
        primaryStage.setScene(scene);
        primaryStage.setTitle("单行面板");
        primaryStage.show();

    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}

posted @ 2021-02-15 21:05  xl4ng  阅读(108)  评论(0编辑  收藏  举报