java3djoglnetbeans7.0jzy3d

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


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.


Solution

  • 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.