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 |
Hi -
You can always use "String.valueOf()": Quote:
Quote:
|
All times are GMT -5. The time now is 06:59 AM. |