Embedding a Java 3D SimpleUniverse object in a Swing Component

Java 3D objects are integrated in Swing components using Canvas3D as the bridge between the panel and the SimpleUniverse object.

While it is not difficult to integrate them together, it requires a little plumbing code to get it to show correctly on screen, so here is a minimal working example that anyone can use as a starting point in their Swing application.

I removed any unnecessary code and left the bare minimum that would display any arbitrary 3D object (a sphere in this case) on a JFrame window.

Comments