Notes about IntelliJ IDEA 4.0 GUI Builder

An early hurdle you might encounter in using the IDEA 4.0 GUI Builder is filling a control with data.  Most of the examples you will find show how to populate your control with data when it is instantiated.  You can’t really do this when the control is hidden in machine-generated-code-land, so you add it after the fact.  Using a JComboBox named speciesCombo as an example, you can't just say,   speciesCombo.addItem("Walleye"); 

Why would you think it would be that simple?

Instead create an object called a DefaultComboBoxModel, which is used to expose a changable data model for the JComboBox. There are other models for the other controls. Like it says in this tutorial on using lists. So the speciesCombo code would look like this:

                 comboModel = new DefaultComboBoxModel();

        comboModel.addElement("walleye");
        comboModel.addElement("sheepshead");
        comboModel.addElement("bullhead");
        comboModel.addElement("dogfish");
        comboModel.addElement("catfish");

        sizeCombo.setModel(comboModel);