我如何为主fxml中的第二个fxml自动调整大小

问题描述 投票:-3回答:1

我如何在我的第一个fxml中加载我的第二个fxml

javafx javafx-8 javafx-2
1个回答
1
投票

你最多,但每个控制器的Main AnchorPane

这个代码在fxml里面

  <AnchorPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="520" prefWidth="782.0" style="-fx-background-color: White; -fx-background-radius: 15px; -fx-border-radius: 12px;" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="1.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.CreateitemController">

然后在主屏幕,但这个代码用于在单击按钮时打开主屏幕内的第二个屏幕

@FXML
    public void groupshow(ActionEvent event) throws IOException {

        Parent root = FXMLLoader.load(getClass().getResource("/FX/creategroupshow.fxml"));
        setting_page.getChildren().setAll(root);

    }

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.