如何解决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
有人知道为什么有时会发生这种情况吗?
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。