我想在我的场景中拍摄一张照片,所以我用过这个:
BufferedImage img = (BufferedImage) SemapGraphResources.ssTerresteImage;
Graphics2D g2 = img.createGraphics();
scene.paint(g2);
scene.validate();
但我得到了这个错误:
堆栈跟踪:
java.lang.AssertionError: Scene.validate was not called after last change. Widget is not validated. See first Q/A at http://graph.netbeans.org/faq.html page.
at org.netbeans.api.visual.widget.Widget.paint(Widget.java:1402)
at org.netbeans.api.visual.widget.Widget.paintChildren(Widget.java:1481)
at org.netbeans.api.visual.widget.Widget.paint(Widget.java:1427)
at org.netbeans.api.visual.widget.Scene.paint(Scene.java:251)