Hi all,
    I'm new to Java3D programming.Actually i have few Shape3D objects arranged in vertical line as seen in the figure in different colors...On the click on any one the objects and when i drag and drop it over another object i want the selected item to move to the Drop position.
 
I have a Box class which extends an Shape3D class.I have a property called ID.I'm using this ID to find the height of the the Box.The Shape3D object is placed inside the TransformGroup. Initally i'm drawing the Boxes exactly where i want.So the initial translation for all Boxes is Zero.All the boxes are placed inside a Transform Group so that i can set Translation to them later.All these TransformGroup objects are placed in a Vector & i'm passing this vector to my Behavior Class.
 
Right now when the user clicks on any 1 of the objects i getting the Shape3D object & getting its ID.With this ID i'm getting the Transform group object from the Vector.I'm getting the selected object's Translation & setting the new translation.I'm calculating the new translation by finding the difference of heights between the selected box & the postion of the box where i'm going to drop this object.
 
For Example :- If i select the Blue Box (in the figure its position is 0) & drop it on the Red(in the figure its position is 5)...I want the Blue box to move to the 5th position & the reamining boxes from blue(i.e White,Orange,Pink,DarkGreen having positions 1,2,3,4 respectively)to come down & have the position 0,1,2,3,4...Even the RED box should also come down by 1 and have the new ID as 4.
 
Everything worked fined for me,until when i was selceting 1 object.But now i want multiple selcetion(i.e when i press CONTROL & select object) & drop it, I want the selectd objects to be placed in the Drop position.
 
For Example : - When i select box at 0th Position(Blue Box) & box at 4th position (Drak Green Box) & drop it at the 1st positon(White Box)...then Blue & Dark Green box should together & placed over the White Box followed by the other boxes.
 
The logic with which i was working doesn't help me. Is there another method to move the Boxes with setting the translation to the TransformGroup or anything else by which i can modify the position.
 
Can anybody help me.
 
Thanks in advance
Ravi

Rack.jpg

Reply via email to