I wonder if anyone could help me.
I'm trying to add items to a JComboBox
:
Pessoa carlos = new Pessoa(12, "Carlos" , 0.0f);
jComboBoxF.addItem(carlos.getNome());
Pessoa maria = new Pessoa(23, "Maria" ,0.0f);
jComboBoxF.addItem(maria.getNome());
In this case the JComboBox
is in the index "0" as the value "Carlos", and in index "1" with the value Maria.
What I liked to know was if adding the name was also possible to add the index, in order to be in this case with two identifiers 12 and 23, 12 for the value Carlos and 23 for the value Maria.
In other words, I want to use People's id's as an index of JComboBox
.
What I mean by this is to use the index of JComboBox
to identify the Person in question, since the index of the combo in this way would be the Person's own ID.