Lets say I have drawn a开发者_如何学编程 cube or a cylinder with Java3d. I would like to for example when I click on the surface of these shapes to build a small cone over it. I would appreciate if there is some examples. thanks
Well i dont have a specific code for you but you could add a action listener to the cube. then with a serperate class with the code for a cone. This is not the entirety of the code but it should provide a good example.
public void class random1 {
cube.addactionListener(this);
}
public void actionlistener(ActionEvent ev)
if(ev.actionEvent = cube){
Random2 rad = new Random2();
rad.cone();
}
}
public void class Random2 {
public void cone(){
// code for the cone has to be in here
}
}
精彩评论