Property "accessibleRole" does not exist or is read-only
我已经在互联网上搜索了一个修复程序,但似乎没有人在此之前收到此错误。
这是我的创建舞台的功能:
public static MainSceneController mainSceneController;
public MainSceneController changeToMainScene() throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainScene.fxml"));
Parent root = (Parent)fxmlLoader.load(); //im getting the error on this line
mainSceneController = fxmlLoader.getController();
Stage stage = new Stage();
stage.setTitle("Test");
stage.setScene(new Scene(root));
stage.show();
return mainSceneController;
}
我很困惑,问题出在哪里?
修改
这是fxml文件:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.effect.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="1200.0" type="BorderPane" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ir.pgforums.MainSceneController">
<top>
<HBox prefHeight="54.0" prefWidth="800.0" BorderPane.alignment="CENTER" />
</top>
<left>
<SplitPane dividerPositions="0.13528336380255943" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" BorderPane.alignment="CENTER">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
</items>
</SplitPane>
</left>
<center>
<SplitPane prefHeight="160.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<items>
<SplitPane dividerPositions="0.13419117647058823" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" style="-fx-border-image-wi: 20px; -fx-border-radius: 5px;">
<children>
<Slider accessibleRole="TREE_VIEW" blockIncrement="5.0" layoutX="111.0" layoutY="35.0" majorTickUnit="5.0" max="24.0" min="1.0" minorTickCount="4" nodeOrientation="RIGHT_TO_LEFT" prefHeight="14.0" prefWidth="1038.0" showTickLabels="true" showTickMarks="true" snapToTicks="true" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="28.0" />
<DatePicker layoutX="14.0" layoutY="2.0" />
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<SplitPane dividerPositions="0.29797979797979796" layoutX="202.0" layoutY="147.0" prefHeight="468.0" prefWidth="638.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<SplitPane layoutX="62.0" layoutY="188.0" orientation="VERTICAL" prefHeight="466.0" prefWidth="306.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" style="-fx-border-style: none;">
<children>
<VBox layoutX="102.0" layoutY="88.0" prefHeight="464.0" prefWidth="304.0" style="-fx-border-style: none;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<StackPane prefHeight="336.0" prefWidth="304.0" style="-fx-border-style: none;" />
<TextField promptText="Summary">
<VBox.margin>
<Insets left="5.0" right="5.0" />
</VBox.margin>
</TextField>
<TextArea prefHeight="99.0" prefWidth="294.0" promptText="Description">
<VBox.margin>
<Insets bottom="10.0" left="5.0" right="5.0" top="10.0" />
</VBox.margin>
</TextArea>
<GridPane prefWidth="304.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="81.0" style="-fx-background-radius: 100px;" text="Commit" textAlignment="CENTER" GridPane.columnIndex="1" />
</children>
</GridPane>
</children>
</VBox>
</children>
</AnchorPane>
</items>
</SplitPane>
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="797.0" />
</items>
</SplitPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</items>
</SplitPane>
</center>
</fx:root>