Guys,
is there any other way aside from
SelectedIndex method to place a text in a combobox? What if, if I don't know the index of that Item how would I display that text?
I have a Form which contains the Users Information , when I try to modify a user, the jcombox will retrieve ( using addItem) all the Group Name saved in the database and at the same time it should
set the Group Name of that user to the combobox as the selected text. below is my code
public UserEditor(java.awt.Frame parent, boolean modal, UserContoller uc) {
super(parent, modal);
initComponents();
this.uc = uc;
ResultSet rs = rc.GetRoleList();
cboRoleName.removeAllItems();
try {
while (rs.next()) {
cboRoleName.addItem(rs.getString("RoleName"));
// cboRoleName.
}
cboRoleName.revalidate();
cboRoleName.repaint();
} catch (SQLException ex) {
} finally {
rs = null;
}
cboRoleName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
}
Thanks Guys
Edited by: vinx1127 on Oct 20, 2008 7:42 PM