After a wrong insert i want to shake a Textfield. For that i have code a static shake animation
public static void shake(Node node) {
TranslateTransition tt = new TranslateTransition(Duration.millis(50), node);
tt.setByX(10f);
tt.setCycleCount(2);
tt.setAutoReverse(true);
tt.playFromStart();
}
This animation is called in a ChangeListener when the input is wrong. This works fine but if the user type wrong characters very fast, the TextField is moving to the right. Is there a way to do a repositioning? Or is there a better way to do this?