Fala galera, blz?
Eu executei esse código logo depois de terminado e ele compilou normal e etc.
Depois que eu fechei a IDE para reiniciar o micro e tentei compilar dnv apresentou o seguinte erro:
CadastrarPJView.java:166: error: cannot find symbol
controle.CadastrarPJ(tf_nome.getText(),tf_email.getText(),tf_telefone.getText(),tf_cnh.getText(),
^
symbol: method CadastrarPJ(String,String,String,String,String,String,String,String,String,String)
location: variable controle of type ClienteCtrl
Note: CadastrarPJView.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Segue o código:
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.border.*;
import javax.swing.text.MaskFormatter;
public class CadastrarPJView extends JFrame
{
JLabel nome, cnpj, telefone,
email, nascimento, cnh, sexo, validadeCnh, ufEmissor, nroRegistro, razaoSocial, ie;
JTextField tf_nome, tf_telefone, tf_razaoSocial, tf_ie,
tf_email, tf_nascimento, tf_cnh, tf_validadeCnh, tf_ufEmissor, tf_nroRegistro;
//objeto text que recebera a mascara do CPF
JFormattedTextField tf_cnpj;
JButton bt_cadastrar, bt_cancelar;
//Objeto que criará a mascara do CPF
MaskFormatter formatter;
protected JPanel contentPane;
protected JComboBox ufEmiss;
public CadastrarPJView() {
setTitle("Cadastrar PJ");
setBounds(400, 300, 475, 350);// Mude aqui a para o tamanho desejado
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);// Absolute Layout
setSize(435, 300);
try{
formatter = new MaskFormatter("##############");
}catch(Exception ecxp){}
tf_cnpj = new JFormattedTextField(formatter);
tf_cnpj.setFocusLostBehavior( JFormattedTextField.PERSIST );
//JCombo do UF Emissor
String[] opcoes ={"SP","RJ","PR", "BA"};
ufEmiss = new JComboBox(opcoes);
ufEmiss.setSelectedIndex(0);
//Labels
nome = new JLabel("Nome do condutor");
cnpj = new JLabel("CNPJ");
telefone = new JLabel("Telefone");
email = new JLabel("Email");
nascimento = new JLabel("Data de nasc.");
cnh = new JLabel("CNH do condutor");
sexo = new JLabel("Sexo");
validadeCnh = new JLabel("Validade CNH");
ufEmissor = new JLabel("UF Emissor");
nroRegistro = new JLabel("N° de registro");
razaoSocial = new JLabel("Razão social");
ie = new JLabel("Inscrição estadual");
//TextFields
tf_nome = new JTextField(45);
//textCpf = new JTextField(11);
tf_telefone = new JTextField(9);
tf_email = new JTextField(9);
tf_nascimento = new JTextField(8);
tf_cnh = new JTextField(8);
tf_validadeCnh = new JTextField(8);
tf_nroRegistro = new JTextField(11);
tf_razaoSocial = new JTextField(45);
tf_ie = new JTextField(30);
//botoes
bt_cadastrar = new JButton("Cadastrar");
bt_cancelar = new JButton("Cancelar");
//Posicionamento dos Labels e JTexts
tf_nome.setBounds(20, 130, 295, 20);
nome.setBounds(20, 110, 150, 20);
tf_cnpj.setBounds(20, 30, 120, 20);
cnpj.setBounds(20, 10, 80, 20);
tf_telefone.setBounds(200, 80, 100, 20);
telefone.setBounds(200, 60, 100, 20);
tf_email.setBounds(20, 80, 170, 20);
email.setBounds(20, 60, 250, 20);
tf_nascimento.setBounds(325, 130, 85, 20);
nascimento.setBounds(325, 110, 120, 20);
tf_cnh.setBounds(20, 180, 100, 20);
cnh.setBounds(20, 160, 150, 20);
tf_validadeCnh.setBounds(130, 180, 90, 20);
validadeCnh.setBounds(130, 160, 100, 20);
nroRegistro.setBounds(230, 160, 100, 20);
tf_nroRegistro.setBounds(230, 180, 100, 20);
tf_razaoSocial.setBounds(150, 30, 270, 20);
razaoSocial.setBounds(150, 10, 220, 20);
tf_ie.setBounds(310, 80, 100, 20);
ie.setBounds(310, 60, 130, 20);
//Botões
bt_cadastrar.setBounds(100, 230, 100, 25);
bt_cancelar.setBounds(230, 230, 100, 25);
//JCombo
ufEmissor.setBounds(340, 160, 80, 20);
ufEmiss.setBounds(340, 180, 70, 20);
//Add labels, JTexts e botões a interface
getContentPane().add(tf_nome);
getContentPane().add(tf_cnpj);
getContentPane().add(tf_telefone);
getContentPane().add(tf_email);
getContentPane().add(tf_nascimento);
getContentPane().add(tf_cnh);
getContentPane().add(tf_validadeCnh);
getContentPane().add(tf_nroRegistro);
getContentPane().add(tf_razaoSocial);
getContentPane().add(tf_ie);
getContentPane().add(nome);
getContentPane().add(cnpj);
getContentPane().add(telefone);
getContentPane().add(email);
getContentPane().add(nascimento);
getContentPane().add(cnh);
getContentPane().add(validadeCnh);
getContentPane().add(nroRegistro);
getContentPane().add(razaoSocial);
getContentPane().add(ie);
getContentPane().add(ufEmissor);
getContentPane().add(bt_cadastrar);
getContentPane().add(bt_cancelar);
getContentPane().add(ufEmiss);
TrataBotao tratador = new TrataBotao();
bt_cadastrar.addActionListener(tratador);
bt_cancelar.addActionListener(tratador);
setVisible(true);
//Fecha apenas a janela que esta aberta
fechaJanela fecha = new fechaJanela();
}
private class TrataBotao implements ActionListener{
public void actionPerformed(ActionEvent evento)
{
if(evento.getSource()== bt_cadastrar){
ClienteCtrl controle = new ClienteCtrl();
controle.CadastrarPJ(tf_nome.getText(),tf_email.getText(),tf_telefone.getText(),tf_cnh.getText(),
tf_nroRegistro.getText(),ufEmiss.getSelectedItem().toString(),tf_validadeCnh.getText(),
tf_nascimento.getText(),tf_cnpj.getText(),tf_ie.getText());
}
}
}
}
Alguem sabe me dizer oque é?
abs,