Why does JComboBox.removeAllItems() throw NullPointerException?

It's not throwing an NPE. Your code is java.lang. NullPointerException at abc.MyClass.

JComboBoxActionPerformed(MyClass. Java:211) at abc.MyClass. Access$000(MyClass.

Java:16) at abc. MyClass$1. ActionPerformed(MyClass.

Java:110) Look at MyClass. Java, line 211.

It's not throwing an NPE. Your code is. Java.lang.

NullPointerException at abc.MyClass. JComboBoxActionPerformed(MyClass. Java:211) at abc.MyClass.

Access$000(MyClass. Java:16) at abc. MyClass$1.

ActionPerformed(MyClass. Java:110) ... Look at MyClass. Java, line 211.

Thanks a million! MyClass. Java, line 211: name = jComboBox.

GetItemAt(spinnerPosition).toString(); which happens just after the removeAllItems. Damn. – JackN Sep 16 '10 at 17:59.

RemoveAllItems does not complain until after items are added (it gets called once before the JComboBox is populated from a configuration file). Stepping through this code I see jComboBox. RemoveAllItems calls JComboBox.

RemoveAllItems which calls DefaultComboBoxModel. RemoveAllElements which calls fireIntervalRemoved. There are seven items in jComboBox and the loop in fireIntervalRemoved is executed about four times before throwing the NullPointerException.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions