0
I’m trying to validate the field txtServicoValor
who gets a guy BigDecimal
, follows my code, the validation is barring both the correct form of the digits and the incorrect, I appreciate the help.
MaskFormatter mask = new MaskFormatter("###.###,#00.00");
JFormattedTextField campoTexto = new JFormattedTextField(mask);
mask.setValidCharacters("0123456789");
validos.install(campoTexto);
if(txtServico.getText().length() > 0
&& txtServicoValor.getText().length() > 0
&& (txtServicoValor.getText().replaceAll("\.", "").replace(",",".")).equals(campoTexto))
{
servico.setServico(txtServico.getText());
servico.setValorServico(new BigDecimal(txtServicoValor.getText().replaceAll("\.", "").replace(",",".")));
}
What becomes the variable
validos
?– Victor Stafusa
there was a typo, what should be in place of valid would be the Mask object. Thanks for the help.
– user18177