hi, keith
I followed your code and everything goes fluently, excepting how to display the combobox in the Form. I first tried the following code:
Code:
protected JComponent createFormControl() {
FormLayout layout = new FormLayout("left:pref, 5dlu, pref:grow");
BeanFormBuilder formBuilder = new JGoodiesBeanFormBuilder(getFormModel(), layout);
final JComboBox typeSelector = formModel.createBoundComboBox(
"parserId", parserList.toArray());
formBuilder.add("parserId");
return formBuilder.getForm();
}
("parserId" is the property name to be displayed as combobox, "parserList" is the choices list ).
The above code displays "parserId" as textfield, rahter than a combobox. Then I have to register the "typeSelector" as property editor for parserId. The final working code is:
Code:
protected JComponent createFormControl() {
FormLayout layout = new FormLayout("left:pref, 5dlu, pref:grow");
BeanFormBuilder formBuilder = new JGoodiesBeanFormBuilder(getFormModel(), layout);
final JComboBox typeSelector = formModel.createBoundComboBox(
"parserId", parserList.toArray());
formModel.registerCustomEditor("parserId", new PropertyEditorSupport(){
public boolean isPaintable() {
return true;
}
public Component getCustomEditor() {
return typeSelector;
}
public boolean supportsCustomEditor() {
return true;
}
});
formBuilder.add("parserId");
return formBuilder.getForm();
}
This displays the parserId as combobox properly. Keith, just wondering whether I go the right way this time? :roll: