Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

hugo santos

Problemas com o bean

Recommended Posts

Bom dia pessoal,

Estou estudando Java e fazendo um pequeno programa com Swing. Estou com problema na seguinte situação:

Quando clico no botão incluir, o sistema tem que pegar as informações do jFrame e incluir no banco. mas ele está apresentando o seguinte erro.

 

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: bean/Agendabean

at agenda.IncluirAgenda.jButton1ActionPerformed(IncluirAgenda.java:155)

at agenda.IncluirAgenda.access$000(IncluirAgenda.java:23)

at agenda.IncluirAgenda$1.actionPerformed(IncluirAgenda.java:72)

 

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
       // TODO botao de incluir contatos na agenda:        
       if (!"".equals(jTextField1.getText()) && !"".equals(jTextField2.getText()) && !"".equals(jTextField3.getText()) && !"".equals(jTextField4.getText())){
           try {
               Agendabean objagenda = new Agendabean();
               objagenda.setNome(jTextField1.getText());
               objagenda.setEmail(jTextField2.getText());
               objagenda.setTelefone(Integer.parseInt(jTextField3.getText()));
               objagenda.setCelular(Integer.parseInt(jTextField4.getText()));

               //envia o objeto para inclusao
               new Agendadao().setInserirContato(objagenda);
               //chama o metodo para atualizar a jtabel novamente
               new Principal().preencherGridJTable();
           } catch (SQLException ex) {
               ex.printStackTrace();
           }
       }else{
           JOptionPane.showMessageDialog(null, "Preencha o campo!");
       }

   }

 

O código bean:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package bean;

/**
*
* @author hugo.hrs
*/
public class Agendabean {

   private Integer idagenda = 0;
   private String nome = "";
   private String email = "";
   private Integer telefone = 0;
   private Integer celular = 0;



   /**
    * @return the nome
    */
   public String getNome() {
       return nome;
   }

   /**
    * @param nome the nome to set
    */
   public void setNome(String nome) {
       this.nome = nome;
   }

   /**
    * @return the email
    */
   public String getEmail() {
       return email;
   }

   /**
    * @param email the email to set
    */
   public void setEmail(String email) {
       this.email = email;
   }

   /**
    * @return the telefone
    */
   public Integer getTelefone() {
       return telefone;
   }

   /**
    * @param telefone the telefone to set
    */
   public void setTelefone(Integer telefone) {
       this.telefone = telefone;
   }

   /**
    * @return the celular
    */
   public Integer getCelular() {
       return celular;
   }

   /**
    * @param celular the celular to set
    */
   public void setCelular(Integer celular) {
       this.celular = celular;
   }

   /**
    * @return the idagenda
    */
   public Integer getIdagenda() {
       return idagenda;
   }

   /**
    * @param idagenda the idagenda to set
    */
   public void setIdagenda(Integer idagenda) {
       this.idagenda = idagenda;
   }


}

 

Não estou entendo a mensagem de erro. Gostaria da ajuda de vocês. Um abraço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

A classe bean.Agendabean não está no seu classpath.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.