developers

    Forum Stats

  • 3,873,729 Users
  • 2,266,635 Discussions
  • 7,911,624 Comments

Discussions

Add EventListener to a Node/BranchGroup...Generate code by clicking

843799
843799 Member Posts: 49,999
edited May 24, 2010 4:08PM in Java 3D
Hi to everybody!
I have a problem with java 3D... i hope you will be able to help me!
In java 3D i have realized a 3Dworld in which i have put several geometry.Box (they are automaticaly placed).
Each Box has a texture taken from a a dataset of pictures in a directory. (the idea is that the boxes with the textures correspond to a preview of the photo).

What is missing is that when the user click on the box, a new window containing the picture (the same of the texture but bigger and in high resolution) will be opened.

If there were a JButton and not a Geometry.Box i will be able to solve the problem, becouse i will add an ActionListener to the JButton and then i will realize the function implementing the ActionPerformed code. However, i can't find an "ActionListener" or an "EventHandler" to add neither to the Node (the Box with the texture) neither to the BranchGroup (or TransformGroup) the box is referring to.

Can someone help me?
Or does anybody have any idea or suggestions to solve the problem in a different way?

Thanks a lot!

Comments

  • 843799
    843799 Member Posts: 49,999
    You could use pickBehaviors. They are used to click an object and then rotate, zoom,... with mouse. This is documented in chapter 4 of tutorial.
    With that you can use a Pickresult. This is a way to get all nodes in the graph you selected. adn then do the job you want on shape3d, tg's,...
    If you need further help, tell me. I could give you some working code.
    Regards
    I hope this will help you
    jfp
This discussion has been closed.
developers