在javafx场景bulider中的chanding场景

时间:2017-12-08 09:27:17

标签: javafx

我正在尝试在javafx scenebuilder中创建一个加载页面,但是我在行rootPane.getChildren()。setAll(pane)上出现错误,它强调了etChildren()并说它没有找到符号,不明白为什么是

package javafxapplication14;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;

public class FXMLDocumentController implements Initializable {

    private Label label;

    private Object theStage;
    private Object rootPane;

    @Override
    public void initialize(URL url, ResourceBundle rb) {

    }    

    private void loadsecond(ActionEvent event) throws IOException {
        AnchorPane pane=FXMLLoader.load(getClass().getResource("Second.fxml"));
        rootPane.getChildren().setAll(pane);
    }
}

1 个答案:

答案 0 :(得分:0)

班级Object无法处理.getChildren()