将 NetBeans IDE 6.7 与 J3D 的 Canvas3D 容器结合使用
我一直告诉自己这应该很简单,但我完全迷失了。 首先我要说的是,我是 NetBeans IDE 的新手,并且出于需要而使用它。 我对此还不太了解。
我已经成功地为我的应用程序设计了主窗口。 应用程序的右侧本质上是一个三维空间的大窗口,可以可视化数据集上的某些转换。 我已经搜索了调色板和调色板管理器,甚至尝试从 JAR 手动将 Canvas3D 组件添加到调色板,但我仍然无法获取它。
我真的希望能够将该组件拖放到我的应用程序中,直观上来说,这似乎是可能的。 我使用的是 Mac OS X; 我的“关于 NetBeans”的输出说明了更多信息。
产品版本:NetBeans IDE 6.7(内部版本 200906241340)
Java:1.5.0_
19; Java HotSpot(TM) 客户端虚拟机 1.5.0_
19-137
系统:Mac OS X 版本10.5.7,运行于i386; 麦克罗曼; en_US (nb)
Userdir:/Users/dremelofdeath/.netbeans/6.7
提前感谢您帮助我 - 我真的很感激。
I keep telling myself that this should be simple, and yet I'm completely lost. Let me start by saying that I'm new to NetBeans IDE, and that I am using it out of necessity. I don't really know much about it yet.
I have successfully designed my main window for my application. The right side of the application is essentially a large window into a three-dimensional space that visualizes certain transforms on data sets. I have searched through the palette and the palette manager and even tried to add the Canvas3D component to the palette manually from a JAR, but I still can't get it.
I would really like to be able to drag and drop this component into my application, and intuitively, it seems possible. I'm on Mac OS X; the output from my About NetBeans tells more.
Product Version: NetBeans IDE 6.7 (Build 200906241340)
Java: 1.5.0_
19; Java HotSpot(TM) Client VM 1.5.0_
19-137
System: Mac OS X version 10.5.7 running on i386; MacRoman; en_US (nb)
Userdir: /Users/dremelofdeath/.netbeans/6.7
Thanks in advance for helping me out -- I really appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Canvas3D 是一个重量级组件,这意味着它使用本机对等组件来连接 DirectX 或 OpenGL,因此这种组件可能无法用于拖放。 尽管您可以尝试扩展 JPanel。
您可以使用 BoderLayout 非常轻松地手动设置布局。
The Canvas3D is a heavyweight component meaning it uses a native peer component to hook into DirectX or OpenGL so probably this kind of component is not available for drag and drop. Though you could try extending a JPanel.
You can setup the layout manually quite easily using a BoderLayout.
完整的初学者指南:
将该容器的名称设为canvasContainer。
向类添加公共变量。 (我假设类名是MyJFrame)
<块引用>
公共Canvas3D canvas3D;
框架类的构造如下:
<块引用>
公共 MyJFrame() {
initComponents();
}
编辑如下:
<块引用>
公共 MyJFrame() {
initComponents();
canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
canvasContainer.add(canvas3D, "中心");
canvas3D.setSize(canvasContainer.getWidth(), canvasContainer.getHeight());
}
在调整容器大小时向容器添加侦听器:(通常在调整窗口大小时)
选择容器\Properties\Events\componentResized\canvasContainerComponentResized
输入以下代码:
<块引用>
if (canvas3D!=null)
canvas3D.setSize(canvasContainer.getWidth(), canvasContainer.getHeight());
Complete beginner guide:
Let the name of that container be canvasContainer.
Add a public variable to the class. (I assume the class name is MyJFrame)
The construction of the frame class is as follows:
Edit it as follows:
Add a listener to the Container when it is resized: (Often when the window is resized)
Choose the container \ Properties \ Events \ componentResized \ canvasContainerComponentResized
Type the following code: