Name of JComboBox as string

Hi,

How can Iset name of JComboBox as string in the definition as String?

I get this name as String from my database.

I want to write something like:

String componentName= rs.getString("name");

JComboBox componentName =new JComboBox();

Thanks :)

[355 byte] By [yael800a] at [2007-11-26 18:52:40]
# 1
Use a hashmap.
CeciNEstPasUnProgrammeura at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 2

I don't understend,

in my DB I have:

name column type as String

|name|

usersCombo

animalsCombo

You mean: ?

Map<JComboBox, String> mapCombos = new HashMap<JComboBox, String>();

mapCombos.put(new JComboBox(), rs.getString("name"));

[code]

Then, How can I thak one of this combo?

Like this? so I must to save this names also?

[code]

JComboBox = mapCombos.get(specificName);

yael800a at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 3
Yes. Just with the Strings as keys, not as values.
CeciNEstPasUnProgrammeura at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 4
so I have to save this Strings kes in my java applicaion, to use this combo after the created?How to save them?I will use this on my code in some playce:comboMap.get(name).setRenderer(new MyComboRenderer());
yael800a at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 5
> so I have to save this Strings kes in my java> applicaion, to use this combo after the created?> How to save them?By putting them into the map?
CeciNEstPasUnProgrammeura at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 6

I have this:

mapCombos.put(rs.getString("name"), new JComboBox());

I whant to set renderer or font.. to every JComboBox

How to take them (one by one) to set them renderer?

for(int i = 0; i< mapCombo.size(); i++)

{

comboMap.get(name).setRenderer(new MyComboRenderer());

}

How to get this name? I can't get the key name from the combobox, so How I will have this name to get the specipic combo?

yael800a at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...
# 7
> How to get this name? I can't get the key name from> the combobox, so How I will have this name to get the> specipic combo?Did you ever consider to read the API docs to find out whether there's a method to obtain all stored keys?
CeciNEstPasUnProgrammeura at 2007-7-9 6:26:43 > top of Java-index,Java Essentials,Java Programming...