小编Phi*_*ean的帖子

intellij-idea中的多重选择?

是否可以像在sublimetext2编辑器(sublimetext)中那样进行多项选择并同时更改它们?

intellij-idea sublimetext2

16
推荐指数
2
解决办法
6514
查看次数

JavaFX 2.0 + FXML - 奇怪的查找行为

我想找到装有一个场景中的垂直框节点FXMLoader感谢Node#lookup(),但我得到以下异常:

java.lang.ClassCastException: com.sun.javafx.scene.control.skin.SplitPaneSkin$Content cannot be cast to javafx.scene.layout.VBox

代码 :

public class Main extends Application {  
    public static void main(String[] args) {
        Application.launch(Main.class, (java.lang.String[]) null);
    }
    @Override
    public void start(Stage stage) throws Exception {
        AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("test.fxml"));
        Scene scene = new Scene(page);
        stage.setScene(scene);
        stage.show();

        VBox myvbox = (VBox) page.lookup("#myvbox");
        myvbox.getChildren().add(new Button("Hello world !!!"));
    }
}
Run Code Online (Sandbox Code Playgroud)

fxml文件:

<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml" >
  <children>
    <SplitPane dividerPositions="0.5" focusTraversable="true" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" …
Run Code Online (Sandbox Code Playgroud)

java javafx-2 fxml

5
推荐指数
2
解决办法
7247
查看次数

标签 统计

fxml ×1

intellij-idea ×1

java ×1

javafx-2 ×1

sublimetext2 ×1