2
Copyright 2010, 2012, 2014 Jose Robson Mariano Alves
4
This file is part of bgfinancas.
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
11
This package is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
23
import java.text.ParseException;
24
import javax.swing.text.DefaultFormatterFactory;
25
import javax.swing.text.MaskFormatter;
27
public class Mascaras {
31
public static DefaultFormatterFactory Cep()
33
MaskFormatter cep = null;
36
cep = new MaskFormatter("##.###-###");
38
catch (ParseException e) { }
39
DefaultFormatterFactory factory = new DefaultFormatterFactory(cep, cep);
43
public static DefaultFormatterFactory Data()
45
MaskFormatter data = null;
48
data = new MaskFormatter("##/##/####");
50
catch (ParseException e) { }
51
DefaultFormatterFactory factory = new DefaultFormatterFactory(data, data);
55
public static DefaultFormatterFactory CPF()
57
MaskFormatter cpf = null;
60
cpf = new MaskFormatter("###.###.###-##");
62
catch (ParseException e) { }
63
DefaultFormatterFactory factory = new DefaultFormatterFactory(cpf, cpf);
67
public static DefaultFormatterFactory CNPJ()
69
MaskFormatter cnpj = null;
72
cnpj = new MaskFormatter("##.###.###/####-##");
74
catch (ParseException e) { }
75
DefaultFormatterFactory factory = new DefaultFormatterFactory(cnpj, cnpj);