Problem with JdbComboBox


2006-06-06 04:23:00 PM
jbuilder6
Hello,
I have interesting problem with JdbComboBox. When drop-down list is
long enough to be painted outside the form, after using it, I close and
re-open form - after then drop-down list ignores mouse motion (but
mouse wheel and keyboard work). Combo field is ok, only drop-down list
is not working properly.
Is there some bug in JdbComboBox?
I populate items into JdbComboBox in following code:
public static void populateCombo(JdbComboBox cb, Vector values){
cb.removeAllItems();
int maxWidth = 5;
cb.setMaximumRowCount(20);
int cnt=cb.getItemCount();
String oldValue="???";
if (cnt>0) {
oldValue = cb.getSelectedItem().toString();
}
for (int i=0; i<values.size() ;i++){
cb.addItem(values.get(i));
if (values.get(i).toString().length()>maxWidth)
maxWidth = values.get(i).toString().length();
}
cb.setDropDownWidth((int)(maxWidth * cb.getFont().getSize() / 2 +
20));
for (int i=0;i<cb.getItemCount();i++)
if (cb.getItemAt(i).toString().compareTo(oldValue)==0){
cb.setSelectedIndex(i);
return;
}
}