4

VBox.getChildren() ObservableListを自分のものにバインドしたいObservableList。そのため、プロセスが画像を検出すると、その画像がリストに追加され、自動的にVBoxに追加されます。

 Bindings.bindContentBidirectional(myList,vbox.getChildren());

以下の例外がスローされます。

スレッド「Thread-3」の例外java.lang.UnsupportedOperationException

それを行う他の方法はありますか?上記の問題は何ですか?

4

1 に答える 1

7

バインディングの問題ではありません。あなたのアプローチは正しいです。UnsupportedOperationExceptionFXの古いバージョンが原因である可能性があります。

たとえば、次の例はJavaFX2.2を使用して機能します。

public void start(Stage primaryStage) {
    ObservableList<Node> list = FXCollections.<Node>observableArrayList();
    VBox root = new VBox();

    Bindings.bindContentBidirectional(list, root.getChildren());
    list.add(new Button("Test"));

    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
}
于 2013-02-05T12:32:53.693 に答える