
June 16th, 2005, 09:48 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: near Raleigh,NC
Posts: 4
Time spent in forums: 1 h 30 m 17 sec
Reputation Power: 0
|
|
|
setSelectedItem
I am trying to set the item in a combo box from an Access db.
I did get the 'Object' from Access (shown in NetBeans debugger) but when I do a setSelectedItem it does nothing.
I do have a null value in my combo box list.
Here is the code fragments:
cboType.setEditable(true);
cboType.setFont(new java.awt.Font("MS Sans Serif", 0, 10));
cboType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "List", "Visual Basic Code", "Lotus Notes Code", "Java Code" }));
.
.
.
// name returns 'List'
Object name = resultset.getString("TYPE");
// displays the null value in the combo box
cboType.setSelectedItem(name);
|