是否可以在 Netbeans 7.0 应用程序中使用 Jzy3D? [英] Is it possible to use Jzy3D in a Netbeans 7.0 application?

查看:23
本文介绍了是否可以在 Netbeans 7.0 应用程序中使用 Jzy3D?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我们正在尝试将 3D 散点图合并到我们在 Netbeans 7.0 中的项目中,我们选择测试的库之一是 Jzy3D.看起来它会做我们需要它做的一切,但不幸的是,它什么也没做.

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.

我已正确安装 JOGL,并对其进行了测试并发现它可以正常工作.然后我包含了与演示中相同的依赖项.我也试过直接包含 .jars.是的,gluegen-rt.jar 位于库文件夹中.

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.

为了让 JOGL 工作,我们不得不大量修改构建设置.老实说,我的老板做了大部分工作,所以我还不完全确定如何复制它.现在,我正在尝试将图表放入 JFrame,而 Jzy3D 库中的 FrameSwing 扩展出现以下错误:

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.

更新: CanvasAWT 似乎是从 Canvas 扩展而来的,而 Canvas 是从 Component 扩展而来的,而不是 JComponent.这似乎是问题所在,我已将其提交给 Jzy3D 作者.

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.

推荐答案

也许您忘记使用构造函数中的swing"选项创建图表,如此处.它使用 CanvasSwing 创建图表,它是 Swing 应用程序中预期的 JComponent.

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.

构建 Swing 图表会创建一个 JOGL 轻量级组件,该组件可以与其他出现在顶部的 JComponents 混合(默认的 AWT 图表是重量级的,并保留在任何其他 UI 组件的顶部).

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 已经在 Swing 和其他窗口工具包中取得了成功,所以它应该适合您.

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

这篇关于是否可以在 Netbeans 7.0 应用程序中使用 Jzy3D?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆