mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
trim leading and trailing whitespace from pay to address field
This commit is contained in:
parent
3cf99961d3
commit
3aa00076c6
1 changed files with 12 additions and 0 deletions
|
@ -210,6 +210,18 @@ public class PaymentController extends WalletFormController implements Initializ
|
||||||
revalidateAmount();
|
revalidateAmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
address.setTextFormatter(new TextFormatter<>(change -> {
|
||||||
|
String controlNewText = change.getControlNewText();
|
||||||
|
if(!controlNewText.equals(controlNewText.trim())) {
|
||||||
|
String text = change.getText();
|
||||||
|
String newText = text.trim();
|
||||||
|
int caretPos = change.getCaretPosition() - text.length() + newText.length();
|
||||||
|
change.setText(newText);
|
||||||
|
change.selectRange(caretPos, caretPos);
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}));
|
||||||
|
|
||||||
address.textProperty().addListener((observable, oldValue, newValue) -> {
|
address.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
address.leftProperty().set(null);
|
address.leftProperty().set(null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue