Hello. I posted this under the Newbies category but haven’t gotten anywhere so I thought I’d post it here and see if I might be able to get some more assistance.
I am currently trying to take Sun’s SphereMotion.java file and work it into a black hole simulator for a college project. I am trying to setup my basic geometry and am currently trying to add a KeyListener whereby I can use keyboard commands (the arrows in particular) to rotate the view around my ellipsoids. Also note that I am a newbie.
The KeyListener is added to my canvas as it is the only think I could find that would allow a KeyListener to be added to. I then read online that it would be good to create a switch to tell the program when to process the rotations however I can’t get it to work. It simply doesn’t do anything.
Thus far I have tried adding my transforms to the BranchGroup createSceneGraph but that didn’t work. Recently I tried placing the rotation transforms in their own BranchGroup and adding the other transforms for the ellispoids as a child under that BranchGroup. But this also has not worked. I’m fairly certain that my KeyListener is working.
Does anybody have any suggestions on the proper way to pull this off?
I have posted my code at http://www.astroh.org/SphereMotion.java since it is too long to post in this forum.
Much thanks in advance!
Michael