estou com um problema de mascaração esta dando erro variable mt5 migth not have been initialized
o que eu faço .
poste o seu codigo fica mais facil ver onde ta o problema
t5= new JFormattedTextField(mt5);
t5.setBounds(10,260,100,30);
t5.setForeground(Color.white);
t5.setBackground(Color.white);
t5.setFont(new Font(“Arial”,Font.BOLD,13));
tela2.add(t5);
desde ja agradeço a colaboração
joede.fadel
sou iniciante na liguagem se poder me da uns toques com sites foruns agradeço
t5= new JFormattedTextField(mt5);
Se o erro aparece na tal linha, provavelmente a causa do erro é devida a algo que aparece ANTES dela. Poste o resto do seu programa.
cadastro1.addActionListener
(
new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
setTitle("CADASTRO DE CLIENTES");
Container tela2=getContentPane();
setLayout(null);
JLabel nome,endereco,email,bairro,cep,tel,dn,cpf,rg,fax,cnpj;
JTextField t1,t2,t4,t9;
JFormattedTextField f3,f5,f6,f7,f8,f10,f11;
MaskFormatter mf3,mf5,mf6,mf7,mf8,mf10,mf11;
try
{
mf3 = new MaskFormatter("#####-###");
mf5 = new MaskFormatter("##/##/####");
mf6 = new MaskFormatter("(##)####-####");
mf7 = new MaskFormatter("########-#");
mf8 = new MaskFormatter("#########-##");
mf10 = new MaskFormatter("(##)####-####");
mf11= new MaskFormatter("##.###.###/####-##");
mf3.setPlaceholderCharacter('_');
mf5.setPlaceholderCharacter('_');
mf6.setPlaceholderCharacter('_');
mf7.setPlaceholderCharacter('_');
mf8.setPlaceholderCharacter('_');
mf10.setPlaceholderCharacter('_');
mf11.setPlaceholderCharacter('_');
}
catch(ParseException excp){}
f3= new JFormattedTextField(mf3);
f3.setBounds(10,140,40,30);
f3.setForeground(Color.white);
f3.setBackground(Color.white);
f3.setFont(new Font("Arial",Font.BOLD,13));
tela2.add(f3);
f5= new JFormattedTextField(mf5);
f5.setBounds(10,260,100,30);
f5.setForeground(Color.white);
f5.setBackground(Color.white);
f5.setFont(new Font("Arial",Font.BOLD,13));
tela2.add(t5);
}
e onde está a declaração da tal variavel mt5?
Desculpa Rissato eu troquei as variaveis mt5 para mf5
so da erro quando eu converto
f5= new JFormattedTextField(mf5);