java - 当 BorderPane.setLeft 出现 IndexOutOfBoundsException
问题描述
当我尝试在 BorderPane 中执行 setLeft 时,有时会出现错误。问题来自以下行:
bpDetail.setLeft(selected ? ivSelected : null);
我想在borderPane左侧选择某些东西时绘制图像,但有时程序会抛出以下错误:
Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at java.util.ArrayList.rangeCheck(ArrayList.java:657)
at java.util.ArrayList.get(ArrayList.java:433)
at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
at com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)
at javafx.scene.Parent$2.onProposedChange(Parent.java:423)
at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:329)
at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
at javafx.scene.layout.BorderPane$BorderPositionProperty.invalidated(BorderPane.java:673)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
at javafx.scene.layout.BorderPane.setLeft(BorderPane.java:314)
at main.Selectable.showSelected(Selectable.java:594)
at main.Selectable.initialize(Selectable.java:300)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
... 14 more
有谁明白为什么有时会发生这种情况?
提前致谢!
解决方案
推荐阅读
- python - 在 matplotlib 中添加 graphviz 图
- php - 如何在html中使用baseurl链接编写td标签?
- r - 如何从 data.frames 列中的列表中提取第一个值?
- php - 单击按钮 [action] 后,如何显示 modal ?
- node.js - 如果它是全局安装的模块,则可以要求但不能导入
- html - CSS 3D 立方体和 css-transform
- python-3.x - 如何刮取中等配置文件?
- python - matplolib中hlines末尾的标记?
- php - Dompdf UTF-8 不工作但显示在文件中
- swift - LPLinkView 的 LPMetadataProvider 缓慢而密集