Is it possible to use Jzy3D in a Netbeans 7.0 application?

六月ゝ 毕业季﹏ 提交于 2019-12-18 09:36:29

问题


Alright, so we're trying to incorporate a 3D scatterplot into our project in Netbeans 7.0, and one of the libraries we chose to test was Jzy3D. It looks likes it would do everything we needed it to, but unfortunately, it's not doing anything.

I have JOGL installed properly, and have tested it and found it to be working. Then I have included the same dependencies as in the demo. I have also tried directly including the .jars. And yes, gluegen-rt.jar is in the library folder.

EDIT: To get JOGL working, we had to heavily modify build settings. Honestly, my boss did most of it, so I'm not entirely sure how to replicate it yet. Now, I'm trying to put a chart in a JFrame, and the FrameSwing extension from the Jzy3D library is giving the following error:

Exception in thread "main" java.lang.ClassCastException: org.jzy3d.plot3d.rendering.canvas.CanvasAWT cannot be cast to javax.swing.JComponent
    at org.jzy3d.bridge.swing.FrameSwing.(FrameSwing.java:36)
    at scratchwork.My3DChart.main(My3DChart.java:40)

I'll keep working at it, but if someone knows what's wrong, it would be nice to know.

Update: It appears that CanvasAWT is extended from Canvas which is extended from Component, not JComponent. This seems to be the problem, and I've submitted it to the Jzy3D authors.


回答1:


Maybe you forgot to create the chart using the "swing" option in the constructor as stated here. It creates the chart with a CanvasSwing which is a JComponent as expected in a Swing app.

Building a Swing chart creates a JOGL lightweight component that can be mixed with other JComponents appearing on top (the default AWT chart is heavyweight and remains on top of any other UI component).

Jzy3d has already been working with success both in Swing and other Windowing toolkits, so it should work for you.



来源:https://stackoverflow.com/questions/6494668/is-it-possible-to-use-jzy3d-in-a-netbeans-7-0-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!