in my company we got a task to implement an autoexpandable textfield. As this functionality is not provided by default we had to develop it from scratch. There are many posibil
that's work for me fine
field.setMinWidth(40);
field.textProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue extends String> observable, String oldValue,
String newValue) {
int len = newValue.length();
field.setPrefWidth(len*10);
if(newValue.isEmpty() || oldValue.isEmpty()){
field.setPrefWidth(40);
}
});