Bonjour,

J'ai un petit probl�me.

public abstract class A extends JPanel{

        public PanelSchema(){
                super();
                init();
        }
        public abstract void init();
}

public class TestPanel extends PanelSchema {

        private JLabel _raisonSociale = null;
        private JTextField _raisonSocialeText = null;

        public void create(){
                String text = _raisonSocialeText.getText();
                ...
        }

        public void init(){
                _raisonSociale = new JLabel("raisonSociale");
                _raisonSocialeText = new JTextField(20);

                setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

                GridBagLayout gridBagLayout1 = new GridBagLayout();
                setLayout(gridBagLayout1);

                add(_raisonSociale,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
                    ,GridBagConstraints.WEST, GridBagConstraints.NONE, getInsets
(),
5, 5));

                add(_raisonSocialeText, new GridBagConstraints(1, 0, 1, 1, 0.0, 
0.0
                    ,GridBagConstraints.WEST, GridBagConstraints.NONE, getInsets
(),
5, 5));
        }

        public Insets getInsets(){
                return new Insets(0, 0, 0, 0);
        }
}

Si apres avoir creer une instance de TestPanel j'appelle la methode create()
j'ai un nullpointerexecption.
Pourquoi ? Comment je peux resoudre ce probl�me.
  • RE: fduthie
    • RE: Zeljko VELAJA

Répondre à