![]() |
| ||
| question on java I add integer values in combo box.When I call getSselectedItem it return object.How i convert it into integer. |
| ||
| Re: question on java I assume you are after JavaScript, not Java. Anyway with JavaScript values are not strongly typed, so if the values are numbers, you can use "+". |
| ||
| Re: question on java Quote:
so, cast it to a String, and parse that to an int. for instance, you get back an Object with value = "6"; public int objectToInt(Object givenObject){'t voila, instant integer-value. this will only work if the value stored in the object is a valid integer value, so if you have any other data in that list, you may want to catch possible exceptions. |
| ||
| Re: question on java If you added the items as Integer objects: int selectedValue = ((Integer)comboBox.getSelectedItem()).intValue(); |
| All times are GMT -4. The time now is 12:10 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC