Answer the question
In order to leave comments, you need to log in
How to override the TextField method if it has already been created?
Good!
There is a code
package com.extensions.textFild;
import javafx.scene.control.TextField;
public class TextFieldFiltersInput extends TextField {
@Override
public void replaceText(int start, int end, String text) {
if (!"1234567890.\b".contains(text)) {
text = "";
}
super.replaceText(start, end, text);
}
}
package com.extensions.textFild;
import javafx.scene.control.TextField;
public class testText {
private TextField textField;
public testText(TextField textField) {
this.textField = textField;
}
}
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