public void acessaTecladoNumerico( JFormattedTextField campoAtual, JFormattedTextField proximoCampo) { if (Inicio.isMobile()) { campoAtual.setBackground(new Color(255, 255, 190)); TelaTecladoNumerico tela = new TelaTecladoNumerico(null, true, campoAtual, proximoCampo); tela.setVisible(true); } }
@Override public Object stringToValue(String text) { Pattern pattern = getPattern(); Matcher matcher = pattern.matcher(text); if (matcher.matches()) { setMatcher(matcher); // set text to be green dce.setForeground(foreground); dce.setBackground(backgound); return text; } else { // set text to be red when it's not correct dce.setForeground(warningForeground); dce.setBackground(warningBackground); if (discardOnInvalid) { return ""; } return text; } }