dcsimg
Pad JComboBox items with <>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rami_Abramson
Posted On:   Tuesday, July 16, 2002 09:04 AM

sorry for the previous question. Hello, We get a list of objects to display in a ComboBox, and some of them we want to pad with the <> characters just for the display (they are predefined entries). The issue that rises is that if the item selected is one of these we want to retrieve it without the <>. For example, the combo contains: AAA BBB ZZZ and is selected. Now how do we succeed that the combo.getSelectedItem() returns the original item without the <> - 'None'. thank you, Rami    More>>
			
sorry for the previous question.

Hello,

We get a list of objects to display in a ComboBox, and some of them we want to pad with the <> characters just for the display (they are predefined entries).
The issue that rises is that if the item selected is one of these we want to retrieve it without the <>.

For example, the combo contains:


AAA
BBB
ZZZ

and is selected.
Now how do we succeed that the combo.getSelectedItem() returns the original item without the <> - 'None'.

thank you,

Rami
   <<Less

Re: Pad JComboBox items with &lt;&gt;

Posted By:   Axel_Richter  
Posted On:   Wednesday, July 17, 2002 04:28 AM

If there are always only 1 "<" before and 1 ">" after the items, you can try:


combochoice = combo.getSelectedItem();
if (combochoice.startsWith("<"))
combochoice=combochoice.substring(1, combochoice.length()-1);
About | Sitemap | Contact