Is there a way to limit the input of a TextFieldTableCell similar to a TextField

Viewed 28

Currently I'm using the textProperty of the TextField and adding a listener to limit the characters that can be entered into the TextField.

I'm wondering if this is applicable to the TextFieldTableCell too, so that the characters that can be entered when modifying a table cell is only limited to numeric values say.

I'm using this code for the TextField to limit it to only numeric input:

textProperty().addListener((observable, oldValue, newValue) -> {
     if (!newValue.matches("\\d{0,5}([.]\\d{0,2})?")) {
         setText(oldValue);
     }
});
0 Answers
Related