mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-26 05:26:45 +00:00
be more lenient in parsing pasted btc values to send tab textfields
This commit is contained in:
parent
ad8e17a3a0
commit
60e3d4e107
1 changed files with 9 additions and 3 deletions
|
@ -5,9 +5,9 @@ import javafx.scene.control.TextFormatter;
|
||||||
import javafx.scene.control.TextInputControl;
|
import javafx.scene.control.TextInputControl;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class CoinTextFormatter extends TextFormatter<String> {
|
public class CoinTextFormatter extends TextFormatter<String> {
|
||||||
|
@ -51,9 +51,15 @@ public class CoinTextFormatter extends TextFormatter<String> {
|
||||||
commasRemoved = newText.length() - noFractionCommaText.length();
|
commasRemoved = newText.length() - noFractionCommaText.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!coinValidation.matcher(noFractionCommaText).matches()) {
|
Matcher matcher = coinValidation.matcher(noFractionCommaText);
|
||||||
|
if(!matcher.matches()) {
|
||||||
|
matcher.reset();
|
||||||
|
if(matcher.find()) {
|
||||||
|
noFractionCommaText = matcher.group();
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(unitFormat.getGroupingSeparator().equals(change.getText())) {
|
if(unitFormat.getGroupingSeparator().equals(change.getText())) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue