Beispiel #1
0
  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);
    }
  }
Beispiel #2
0
  @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;
    }
  }