How to add numbers in JComboBox
I will show a small snippet what i did :
1. JComboBox petList = new JComboBox();
2. petList.addItem(1);// also tried petList.addItem(new Integer(1));
When i tried to enter string in combo box its ok , working fine , but when tried to enter numbers its bit problem ..
Error shown ...
Error:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
Last edited by vibinlakshman; 02-21-2009 at 03:02 AM.
|