mohammed_BEY
Sep 22, 2015, 06:09 AM
Hello,
I am working on a project made in Java. I want that the width of the textfield change dynamicaly with the text.
This is the code I used it and longChar (String str) return a double according the length of the string 'str'.
The problem: the textfield doesn't show what I am writing even the width changes.
Can any one hepls me ?
Thank you.
tField2.textProperty().addListener((ObservableValu e<? Extends String> ov, String t, String t1) -> {
tField2.setPrefWidth(longChar(tField2.getText()));
});
I am working on a project made in Java. I want that the width of the textfield change dynamicaly with the text.
This is the code I used it and longChar (String str) return a double according the length of the string 'str'.
The problem: the textfield doesn't show what I am writing even the width changes.
Can any one hepls me ?
Thank you.
tField2.textProperty().addListener((ObservableValu e<? Extends String> ov, String t, String t1) -> {
tField2.setPrefWidth(longChar(tField2.getText()));
});