For example, if I enter 32164578542324236.97325074, this number should be displayed in a TextField like 32,164,578,542,324,236.97325074. I tried to handle this, but unsuccessfully:
inputField.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
BigDecimal bd = new BigDecimal(newValue);
NumberFormat formatter = NumberFormat.getNumberInstance();
inputField.setText(formatter.format(newValue));
}
});
Maybe it would be better to use inputField.setTextFormatter(); but I'm not familiar with this method. Thanks in advance!