Skip to main content
gamedev.net
🔒 Locked

[java] Java3D in a Swing application..

Started by ArchangelMorph 2 replies 950+ views
Original Post
ArchangelMorph
ArchangelMorph
I want to create a Swing application to display two 3D models in viewports similar to the kind you'd see in programs like 3D modellers.. I'm ok with my current understand of Swing and seperately with Java 3D (in creating applets) but i've never had any experience in bringing the two together and I've read around the net and it seems like its an area where people seem to have alot of problems.. The question i'd like to raise is what component do I use to display my Java3D model scene in an application frame? would I embedd a canvas3D object into a container like a panel or would that be impossible/too slow? Or would I have to (or would it be easier to..) create a pop-up window or even a pop-up applet to display my Java3D scene? And lastly is the use of Swing even reccomended in this or should I revert back to using awt for compatibility? hope someone can help?
cmptrgear
cmptrgear
I've used Java3D in a Swing application before. You pretty much do it the way that you said, you add a Canvas3D object to your application. One of my applications added the Canvas3D object straight into a JFrame because it didnt have any interactive components and the other application I created added the cavas to a JPanel and added the JPanel to the JFrame.
"Pfft, Facts! Facts can be used to prove anything!" -- Homer J. Simpson
Strife
Strife
As cmptrgear says, that should work. There is absolutely no reason to use AWT over Swing for this, unless all you're using AWT/Swing for is creating a frame... I personally think that AWT controls look horrid, so I stay away from it for everything unless all I'm doing is making a frame.

Also, on a side note, the one thing I particularly like about Java 3D is how well it integrates with Swing. It's really easy to bring up a simple GUI with a 3D viewport with relatively minimal programming, whereas using some API and language it could be a little more complex.

Anyway, the point is, you're on the right track. Let us know how it goes when you try it.
ArchangelMorph
ArchangelMorph
Awesome stuff!!

Thanx man!!

So if I define interactive control buttons using Swing, I can still wire them to the classes that control my Java3D behaviour nodes and affect the scene?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.