Reputation: 43
Well, I am trying to get Java3D working in Scala. I came to notice that the Canvas3D
is a Component
derived class, whereas the scala.swing
classed only allow for, well, swing components, either ScalaComponent
or JComponent
. Here would be my code:
object HelloUniverse extends SimpleSwingApplication {
def top = new MainFrame {
title = "Java3D with Scala"
contents = new BorderPanel {
val config = SimpleUniverse.getPreferredConfiguration()
val canvas = new Canvas3D(config)
peer.add(canvas, "Center")
}
}
}
So yeah, with the .peer
method I get the underlying JPanel
. But how would I add a heavyweight component in there?
Thanks for the help.
Upvotes: 4
Views: 1224
Reputation: 21
The ScalaCanvas3D API provides Scala Swing components for heavyweight and lightweigth Java 3D rendering. See 'Java 3D meets Scala' for more details, sample programs, and downloads : http://www.interactivemesh.org/testspace/j3dmeetsscala.html
Upvotes: 2
Reputation: 17359
Try using JCanvas3D. It is based on JPanel. More info at http://download.java.net/media/java3d/javadoc/1.5.0/com/sun/j3d/exp/swing/JCanvas3D.html
Upvotes: 2