从可观察列表中删除项目

I have an listVeiw which is a list of HBox with a button to delete that HBox from listView.

but the problem is that when I press that button , it will throw an exception. I try to remove that item from another button that is not reside inside HBox and it worked.

myObservableList.remove(lastIndex);

but I want a delete button inside each HBox to delete that entry instead of having a global button to remove the last entry .

评论
下载中....
下载中....

您正在处理两个单独的线程。 1)主JFX线程。 2)事件线程。 事件线程(在队列中)应通过以下方式同步到主JFX线程:

Platform.runLater(()-> {

.... //您的代码粘贴在这里

});

点赞
评论
ni花痴
ni花痴

您正在处理两个单独的线程。 JFX主线程和事件线程。事件线程(在队列中)应通过以下方式同步到主JFX线程:

Platform.runLater(() -> {
  ....// your code
});
点赞
评论