Well, I don't have a special code for you, but you can add an action listener to the cube. then with a serperate class with code for the cone. This is not all the code, but it should serve as 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(){
}
}
source
share