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