eai galera
estou com um problema no menu, quando eu entro no menu cadastro de cliente a tela de traz some e quando eu
entro na tela cadastro de fornecedor so muda o titulo mais a tela fica a mesma sendo que esta é diferente pois são
cadastros diferentes, e também estou com problema na marcaração desde já agradeço
import javax.swing.JOptionPane;
import javax.swing.;
import java.awt.;
import java.awt.event.;
import java.text.;
import javax.swing.text.*;
public class desenvolvimento extends JFrame
{
JMenuBar desenvolvimento;
JMenu clientes,fornecedor;
JMenuItem cadastro1,cadastro2;
JFormattedTextField t3,t5,t6,t7,t8,t10,t11;
MaskFormatter mt3,mt5,mt6,mt7,mt8,mt10,mt11;
public desenvolvimento()
{
super(“PROGRAMA VICTOR”);
Container tela=getContentPane();
setLayout(null);
desenvolvimento=new JMenuBar ();
setJMenuBar (desenvolvimento);
clientes=new JMenu ("clientes");
desenvolvimento.add(clientes);
fornecedor=new JMenu ("fornecedor");
desenvolvimento.add(fornecedor);
cadastro1=new JMenuItem ("cadastro");
clientes.add(cadastro1);
cadastro2=new JMenuItem ("cadastro");
fornecedor.add(cadastro2);
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;
//float n1,n2,n3,n4,n5;
nome= new JLabel("nome");
nome.setBounds(10,60,40,30);
tela2.add(nome);
endereco= new JLabel("endereço");
endereco.setBounds(10,100,100,30);
tela2.add(endereco);
cep= new JLabel("cep");
cep.setBounds(10,140,40,30);
tela2.add(cep);
email= new JLabel("email");
email.setBounds(10,180,40,30);
tela2.add(email);
dn= new JLabel("data nascimeto");
dn.setBounds(300,220,120,30);
tela2.add(dn);
tel= new JLabel("telefone");
tel.setBounds(10,260,100,30);
tela2.add(tel);
rg= new JLabel("rg");
rg.setBounds(10,300,40,30);
tela2.add(rg);
cpf= new JLabel("cpf");
cpf.setBounds(10,340,40,30);
tela2.add(cpf);
bairro= new JLabel("bairro");
bairro.setBounds(10,380,40,30);
tela2.add(bairro);
fax= new JLabel("fax");
fax.setBounds(10,420,40,30);
tela2.add(fax);
cnpj= new JLabel("cnpj");
cnpj.setBounds(10,460,40,30);
tela2.add(cnpj);
t1= new JTextField(30);
t1.setBounds(60,60,200,25);
t1.setForeground(Color.black);
t1.setFont(new Font("arial",Font.BOLD,13));
tela2.add(t1);
t2= new JTextField(30);
t2.setBounds(70,100,200,25);
t2.setForeground(Color.black);
t2.setFont(new Font("arial",Font.BOLD,13));
tela2.add(t2);
//t3= new JTextField(30);
//t3.setBounds(60,140,200,25);
//t3.setForeground(Color.black);
//t3.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t3);
t4= new JTextField(30);
t4.setBounds(60,200,200,25);
t4.setForeground(Color.black);
t4.setFont(new Font("arial",Font.BOLD,13));
tela2.add(t4);
//t5= new JTextField(30);
//t5.setBounds(400,240,100,25);
//t5.setForeground(Color.black);
//t5.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t5);
//t6= new JTextField(30);
//t6.setBounds(60,280,200,25);
//t6.setForeground(Color.black);
//t6.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t6);
//t7= new JTextField(30);
//t7.setBounds(60,320,200,25);
//t7.setForeground(Color.black);
//t7.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t7);
//t8= new JTextField(30);
//t8.setBounds(60,360,200,25);
//t8.setForeground(Color.black);
//t8.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t8);
t9= new JTextField(30);
t9.setBounds(60,400,200,25);
t9.setForeground(Color.black);
t9.setFont(new Font("arial",Font.BOLD,13));
tela2.add(t9);
//t10= new JTextField(30);
//t10.setBounds(60,440,200,25);
//t10.setForeground(Color.black);
//t10.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t10);
//t11= new JTextField(30);
//t11.setBounds(60,480,200,25);
//t11.setForeground(Color.black);
//t11.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t11);
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);
//f6= new JFormattedTextField(mf6);
//f6.setBounds(10,340,40,30);
//f6.setForeground(Color.white);
//f6.setBackground(Color.white);
//f6.setFont(new Font("Arial",Font.BOLD,13));
//tela2.add(f6);
//f7= new JFormattedTextField(mf7);
//f7.setBounds(60,320,200,25);
//f7.setForeground(Color.white);
//f7.setBackground(Color.white);
//f7.setFont(new Font("Arial",Font.BOLD,13));
//tela2.add(f7);
//f8= new JFormattedTextField(mf8);
//f8.setBounds(60,360,200,25);
//f8.setForeground(Color.white);
//f8.setBackground(Color.white);
//f8.setFont(new Font("Arial",Font.BOLD,13));
//tela2.add(f8);
//f10= new JFormattedTextField(mf10);
//f10.setBounds(60,440,200,25);
//f10.setForeground(Color.white);
//f10.setBackground(Color.white);
//f10.setFont(new Font("Arial",Font.BOLD,13));
//tela2.add(f10);
//f11= new JFormattedTextField(mf11);
//f11.setBounds(60,480,200,25);
//f11.setForeground(Color.white);
//f11.setBackground(Color.white);
//f11.setFont(new Font("Arial",Font.BOLD,13));
//tela2.add(f11);
//t1= new JTextField(10);
//t1.setBounds(60,60,40,20);
//t1.setForeground(Color.black);
//t1.setFont(new Font("arial",Font.BOLD,13));
//tela2.add(t1);
setSize (800,500);
setVisible(true);
setLocationRelativeTo(null);
}
}
);
cadastro2.addActionListener
(
new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
setTitle("CADASTRO DE FORNECEDORES");
Container tela3=getContentPane();
setLayout(null);
JLabel nome,endereco,cep,dn,tel,email;
JTextField t1,t2,t3,t4,t5,t6;
float n1,n2,n3,n4,n5;
nome= new JLabel("nome");
nome.setBounds(10,60,40,20);
tela3.add(nome);
endereco= new JLabel("endereço");
endereco.setBounds(10,80,100,20);
tela3.add(endereco);
cep= new JLabel("cep");
cep.setBounds(10,100,40,20);
tela3.add(cep);
email= new JLabel("email");
email.setBounds(10,120,40,20);
tela3.add(email);
dn= new JLabel("data nascimeto");
dn.setBounds(10,140,120,20);
tela3.add(dn);
tel= new JLabel("telefone");
tel.setBounds(10,160,100,20);
tela3.add(tel);
t1= new JTextField(10);
t1.setBounds(60,60,40,20);
t1.setForeground(Color.black);
t1.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t1);
t2= new JTextField(10);
t2.setBounds(60,80,40,20);
t2.setForeground(Color.black);
t2.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t2);
t3= new JTextField(10);
t3.setBounds(60,100,40,20);
t3.setForeground(Color.black);
t3.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t3);
t4= new JTextField(10);
t4.setBounds(60,120,40,20);
t4.setForeground(Color.black);
t4.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t4);
t5= new JTextField(10);
t5.setBounds(60,140,40,20);
t5.setForeground(Color.black);
t5.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t5);
t6= new JTextField(10);
t6.setBounds(60,160,40,20);
t6.setForeground(Color.black);
t6.setFont(new Font("arial",Font.BOLD,13));
tela3.add(t6);
setSize (800,500);
setVisible(true);
setLocationRelativeTo(null);
}
}
);
setSize (800,800);
setVisible(true);
setLocationRelativeTo(null);
}
public static void main(String args[])
{
desenvolvimento MenuNovo;
MenuNovo=new desenvolvimento();
MenuNovo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}