Reputation: 109
I am creating a simple programme in javafx.
private void onClick(final Circle circle) {
circle.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
circle.setTranslateX(150.);
}
});
}
in the "public void start" i match th created circle with the method "onClick"
onClick(circle1);
this code move a circle to the right. How can I move it multiple times? I tried to create more methods analogically "onClick1" but it always respond just to the first click. I need to move it to the right with each click again.
Thank you for your time.
Upvotes: 1
Views: 232