Objetos de um JInternalFrame Pai não são herdados pelo JF filho

5 respostas
M

Olá amigos,

estou com um problema sério :roll: , tenho uma tela genérica JInternalFrame, onde eu tenho um JPanel e um JButton, agora quando e extendo para um Filho: … FormFilho extends FormPai

os objetos não aparecem no form filho, como eu poderia resolver isto???

Agradeceria a ajuda de vc´s.

Estou usando Netbeans 4.

Obrigado galera.

5 Respostas

farribeiro

mflorindo:
Olá amigos,

estou com um problema sério :roll: , tenho uma tela genérica JInternalFrame, onde eu tenho um JPanel e um JButton, agora quando e extendo para um Filho: … FormFilho extends FormPai

os objetos não aparecem no form filho, como eu poderia resolver isto???

Agradeceria a ajuda de vc´s.

Estou usando Netbeans 4.

Obrigado galera.

Na verdade você tem que limpar os arquivos gerados na compilação de preferência os “.class” antigos e gerar novamente a aplicação :wink:

Assim que consegui fazer a façanha. :lol:

M

Não funcionou, dei um Shift+f11.

Abaixo colega, está a estrutura do JInternalFrame filho.

/*

  • NewJInternalFrame.java
  • Created on 17 de Junho de 2005, 23:26
    */

package com.teccontrol.forms;

/**
*

  • @author mmf
    */
    public class NewJInternalFrame extends PadraoGenerico{

    /** Creates new form NewJInternalFrame */
    
    public NewJInternalFrame() {
    
    initComponents();
    
    }
    

    /** This method is called from within the constructor to

    • initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is

    • always regenerated by the Form Editor.
      
      */
      
      // <editor-fold defaultstate=“collapsed” desc=" Generated Code ">
      
      private void initComponents() {
      
      pack();
      
      }
      
      // </editor-fold>
      

    // Variables declaration - do not modify
    // End of variables declaration

}

farribeiro

:idea: Lembrete incial: "use as tagsBB para deixar seu tópicos mais legíveis :!: "

mflorindo:
Não funcionou, dei um Shift+f11. Abaixo colega, está a estrutura do JInternalFrame filho.
/*
 * NewJInternalFrame.java
 *
 * Created on 17 de Junho de 2005, 23:26
 */

package com.teccontrol.forms;

/**
 *
 * @author  mmf
 */
public class NewJInternalFrame extends PadraoGenerico{
    
    /** Creates new form NewJInternalFrame */
    public NewJInternalFrame() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        
        pack();
    }
    // </editor-fold>                        
    
    
    // Variables declaration - do not modify                     
    // End of variables declaration                   
    
}

Onde está armazenado o a classe PadraoGenerico?

Pois ela tem que estar dentro ou visível para a classe filho, se tiver em outra package faça um import :wink:

M

estão no mesmo diretório

eis a estrutura da classe pai:

/*

  • PadraoGenerico.java
  • Created on 16 de Junho de 2005, 19:24
    */

package com.teccontrol.forms;

/**
*

  • @author mmf
    */
    public class PadraoGenerico extends javax.swing.JInternalFrame {

    /** Creates new form PadraoGenerico */
    
    public PadraoGenerico() {
    
    initComponents();
    
    }
    

    /** This method is called from within the constructor to

    • initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is

    • always regenerated by the Form Editor.
      
      */
      
      // 
      
      private void initComponents() {
      
      jPanel1 = new javax.swing.JPanel();
      
      jButton1 = new javax.swing.JButton();
      
      jPanel2 = new javax.swing.JPanel();
      
      jPanel3 = new javax.swing.JPanel();
      
      setBackground(javax.swing.UIManager.getDefaults().getColor(“Table.selectionBackground”));
      
      jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
      
      jPanel1.setMinimumSize(new java.awt.Dimension(10, 30));
      
      jPanel1.setPreferredSize(new java.awt.Dimension(10, 30));
      
      jButton1.setText(“teste”);
      
      jPanel1.add(jButton1);
      

      getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);

      jPanel2.setBackground(new java.awt.Color(102, 102, 255));
      
      jPanel2.setPreferredSize(new java.awt.Dimension(10, 30));
      
      getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);
      

      getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);

      pack();
      
      }
      
      //
      
    // Variables declaration - do not modify
    
    public javax.swing.JButton jButton1;
    
    protected javax.swing.JPanel jPanel1;
    
    protected javax.swing.JPanel jPanel2;
    
    public javax.swing.JPanel jPanel3;
    
    // End of variables declaration
    

}

obrigado.

farribeiro

mflorindo:
estão no mesmo diretório

eis a estrutura da classe pai:

Tentarei explicar como criei o meu JInternal :wink:

Criei o pai sem problemas, depois criei um JInternalFrame novinho e tirei o que tinha na frente do extends JFrame coloque a “classedopai”. Na primeira execução não apareceu, então fiz a recompilação.

Será que o seu filho não está sobrepondo a visibilidade dos componentes do pai?

Criado 18 de junho de 2005
Ultima resposta 20 de jun. de 2005
Respostas 5
Participantes 2