Answer the question
In order to leave comments, you need to log in
How to expand TextField in javaFx, and then Exception falls out?
Good!
I want the TextField, when entering certain (erroneous) values, to correct the result itself. Create a TextField successor class, override the constructor and add an empty setOnAction to it for testing, but the trouble is, when the application starts, I got
Caused by: java.lang.ClassCastException: javafx.scene.control.TextField cannot be cast to mainFx.control.TextFieldControl
package mainFx.control;
import javafx.scene.control.TextField;
public class TextFieldControl extends TextField {
public TextFieldControl() {
super();
this.setOnAction(event -> {
System.out.println(1);
});
}
}
txtName = (TextField) root.lookup("#txtName")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question