Package javax.swing.text

Examples of javax.swing.text.MaskFormatter


    DefaultComboBoxModel model = new DefaultComboBoxModel(perfis);
    perfil = new JComboBox(model);

    try {
      nascimento = new JFormattedTextField(new MaskFormatter("##/##/####"));
      cpf = new JFormattedTextField(new MaskFormatter("###.###.###-##"));
    } catch (ParseException e) {
      e.printStackTrace();
    }

    imagemCpf = new JLabel();
View Full Code Here


    preco = new JTextField();
    escala = new JTextField();
    aeronave = new JComboBox();

    try {
      chegada = new JFormattedTextField(new MaskFormatter("##/##/#### ##:##"));
      partida = new JFormattedTextField(new MaskFormatter("##/##/#### ##:##"));
    } catch (ParseException e1) {
      JOptionPane.showMessageDialog(null, e1.getMessage());
    }

    Vector<Aeronave> vector = new Vector<Aeronave>(getList());
View Full Code Here

    conta = new JTextField(bundle.getString("cancelar.passagem.conta"));
    moeda = new JLabel(bundle.getString("cancelar.passagem.label.moeda"));
    valor = new JLabel("valor");

    try {
      cpf = new JFormattedTextField(new MaskFormatter("###.###.###-##"));
    } catch (ParseException e) {
      ErrorSystem.addException(e, bundle);
    }

    solicitarCancelamento = new JButton(bundle.getString("cancelar.passagem.solicitarCancelamento"));
View Full Code Here

    observacao.setDocument(new JTextFieldLimit(100));

    enviar = new JButton(bundle.getString("atualizar.voo.botao.atualizar"));

    try {
      MaskFormatter mask = new MaskFormatter("##/##/#### ##:##");
      partida = new JFormattedTextField(mask);
      chegada = new JFormattedTextField(mask);
    } catch (ParseException e1) {
      JOptionPane.showMessageDialog(null, e1.getMessage());
    }
View Full Code Here

    DefaultComboBoxModel model = new DefaultComboBoxModel(perfis);
    perfil = new JComboBox(model);

    try {
      nascimento = new JFormattedTextField(
          new MaskFormatter("##/##/####"));
      cpf = new JFormattedTextField(new MaskFormatter("###.###.###-##"));
    } catch (ParseException e) {
      e.printStackTrace();
    }

    imagem = new JLabel();
View Full Code Here

    tituloEmail = new JLabel(bundle.getString("criar.pessoafisica.titulo.email"));
    tipos = new ArrayList<JComboBox>();

    // Botoes e caixas de textos
    // GerarCodigo gerarCodigo = new GerarCodigo("PASSAGEM");
    MaskFormatter mask = null;
    try {
      mask = new MaskFormatter("#");
      mask.setValidCharacters("123456789");
      nascimento = new JFormattedTextField(new MaskFormatter("##/##/####"));
      cpf = new JFormattedTextField(new MaskFormatter("###.###.###-##"));
    } catch (ParseException e1) {
      ErrorSystem.addException(e1, bundle);
    }
    quantidade = new JFormattedTextField(mask);
    nome = new JTextField(bundle.getString("criar.pessoafisica.antes.nome"));
View Full Code Here

   */
  public MaskConverter(final String mask, final Class<?> type)
  {
    try
    {
      maskFormatter = new MaskFormatter(mask);
      maskFormatter.setValueClass(type);
      maskFormatter.setAllowsInvalid(true);
      maskFormatter.setValueContainsLiteralCharacters(true);
    }
    catch (ParseException e)
View Full Code Here

   */
  public MaskConverter(final String mask, final Class<?> type)
  {
    try
    {
      maskFormatter = new MaskFormatter(mask);
      maskFormatter.setValueClass(type);
      maskFormatter.setAllowsInvalid(true);
      maskFormatter.setValueContainsLiteralCharacters(true);
    }
    catch (ParseException e)
View Full Code Here

    // Bloqueando o acesso a instaciar diretamente a classe
  }

  public String formatar(Object valor, String mascara) {
    try {
      MaskFormatter formatter = new MaskFormatter(mascara);
      formatter.setValueContainsLiteralCharacters(false);
      valor = formatter.valueToString(valor);
    } catch (ParseException e) {
      log.info(e.getMessage());
    }
    return valor.toString();
  }
View Full Code Here

  }

  public String limpar(String valor, String mascara) {
    try {
      if (valor.length() == mascara.length()) {
        MaskFormatter formatter = new MaskFormatter(mascara);
        formatter.setValueContainsLiteralCharacters(false);
        valor = formatter.stringToValue(valor).toString();
      }
    } catch (ParseException e) {
      log.info(e.getMessage());
    }
    return valor;
View Full Code Here

TOP

Related Classes of javax.swing.text.MaskFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.