Hi All,
I have defined an own control NumberTextField, build a class accordingly to then use it in the FXML file.
Question: How to include the generated class in the FXML file? What path needs to defined? Where to place the class?
FXML file: What path to set?
FXML File: Here is how the new control is included:
The Java Class
I have defined an own control NumberTextField, build a class accordingly to then use it in the FXML file.
Question: How to include the generated class in the FXML file? What path needs to defined? Where to place the class?
FXML file: What path to set?
B4X:
<?import NumberTextField?>
FXML File: Here is how the new control is included:
B4X:
<NumberTextField id="textfieldMinPerKm2" layoutX="100.0" layoutY="178.0" prefWidth="138.0" promptText="Min per Km" />
The Java Class
B4X:
package com.rwblinn;
import javafx.scene.control.TextField;
public class NumberTextField extends TextField {
@Override public void replaceText(int start, int end, String text) {
if (text.matches("[0-9]") || text == "") {
super.replaceText(start, end, text);
}
}
@Override public void replaceSelection(String text) {
if (text.matches("[0-9]") || text == "") {
super.replaceSelection(text);
}
}
}