10 Replies Latest reply on Mar 20, 2003 9:13 PM by 807546

    getParent() is null

    807546
      I have two classes, C_OptionsPanel and C_OptionsSubPanel, where the first calls the second. When I try to call a method in the first class from an actionPerformed in the second class I get a NullPointerException. Here's a couple lines of code:


      C_OptionsPanel parent = (C_OptionsPanel)this.getParent();
      parent.test(index, text);


      I get a NullPointerException on the second line above. Here's the first few lines of the error:


      ava.lang.NullPointerException

           at comment.C_OptionsSubPanel.rbOptions_actionPerformed(C_OptionsSubPanel.java:214)

           at comment.C_OptionsSubPanel_rbOptions_actionAdapter.actionPerformed(C_OptionsSubPanel.java:231)

           at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)

           at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)

           at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)