gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.impl / src / main / java / org / gvsig / tools / swing / impl / dynclass / SwingHelper.java @ 1405
History | View | Annotate | Download (571 Bytes)
1 |
package org.gvsig.tools.swing.impl.dynclass; |
---|---|
2 |
|
3 |
import javax.swing.ComboBoxModel; |
4 |
import javax.swing.JComboBox; |
5 |
|
6 |
|
7 |
public class SwingHelper { |
8 |
|
9 |
static void setText(JComboBox combo, String text) { |
10 |
|
11 |
ComboBoxModel model = combo.getModel();
|
12 |
for( int i=0; i < model.getSize(); i++ ) { |
13 |
Object item = model.getElementAt(i);
|
14 |
if( item != null ) { |
15 |
if( item.toString().equalsIgnoreCase(text) ) {
|
16 |
combo.setSelectedIndex(i); |
17 |
return;
|
18 |
} |
19 |
} |
20 |
} |
21 |
} |
22 |
|
23 |
} |