我的应用程序有一个ScrollPane包含的非常大的Canvas。
大约1000万像素,JavaFX在画布操作期间开始抛出这些空指针异常:
at com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(Unknown Source)
at com.sun.javafx.sg.prism.NGCanvas.initCanvas(Unknown Source)
at com.sun.javafx.sg.prism.NGCanvas.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.renderForClip(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.renderRectClip(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.renderClip(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.sg.prism.NGGroup.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGRegion.renderContent(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.prism.NGNode.doRender(Unknown Source)
at com.sun.javafx.sg.BaseNode.render(Unknown Source)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(Unknown Source)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(Unknown Source)
at com.sun.javafx.tk.quantum.PresentingPainter.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at com.sun.prism.render.RenderJob.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我认为解决方案必须是虚拟化Canvas。我想这在概念上类似于ListView的实现方式。
请指出您可能知道的与此相关的任何示例或可能提供指导的任何页面。 (虚拟和虚拟化似乎不是用于搜索此主题的有用关键字)
谢谢
答案 0 :(得分:4)
我们遇到了同样的问题。 解释原因如下:https://community.oracle.com/thread/3549359
我们使用以下JVM参数解决了绕过视频卡的问题:
-Dprism.order=sw
您可能希望使用-Xmx增加堆内存,因为它将使用更多内存。