我正在尝试制作一个功能绘图仪。实现缩放(通过添加和删除点) 在缩小我尝试删除chart.Data中的第一个和最后一个元素。 无法删除最后一个元素
inData.remove(inData.size()-1);
我得到一个NullPointerException,当我使用inData.size()时,我得到一个ArrayIndexOutOfBoundsException
代码为完整代码http://pastebin.com/DbMV153n
java.lang.NullPointerException
at javafx.scene.chart.AreaChart.dataItemRemoved(AreaChart.java:153)
at javafx.scene.chart.XYChart.dataItemsChanged(XYChart.java:419)
at javafx.scene.chart.XYChart.access$2600(XYChart.java:50)
at javafx.scene.chart.XYChart$Series$1.onChanged(XYChart.java:1382)
at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:78)
at com.sun.javafx.collections.ObservableListWrapper.remove(ObservableListWrapper.java:185)
at debugPlotter$1.handle(debugPlotter.java:63)
at debugPlotter$1.handle(debugPlotter.java:1)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:60)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:162)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:115)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:47)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$KeyHandler.process(Scene.java:2938)
at javafx.scene.Scene$KeyHandler.access$1700(Scene.java:2868)
at javafx.scene.Scene.impl_processKeyEvent(Scene.java:1431)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:1862)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:107)
at com.sun.glass.ui.View.handleKeyEvent(View.java:280)
at com.sun.glass.ui.View.notifyKey(View.java:577)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
at java.lang.Thread.run(Unknown Source)