I have a combo box that looks like this:
I put it on my panel and now I want to find out what item is selected and assign it to an integer variable...Code://Combo Box JComboBox cboTestNum = new JComboBox(); cboTestNum.addItem("1"); cboTestNum.addItem("2"); cboTestNum.addItem("3"); cboTestNum.addItem("4"); cboTestNum.setSelectedIndex(0);
All I get is Null Pointer problems...
How can I assign the selected item to a variable named test?
is giving me errors...Code:int test; test = Integer.parseInt("" + cboTestNum.getSelectedItem());
Thanks!


Reply With Quote