How Use the Combo Box With Netbeans GUIby Jim Campbell
The "JComboBox" in Netbeans displays a list of items for users. The user chooses one of the items in the combo box that submits to your processing form. Netbeans has a graphical interface with a toolbox, so you only need to drag and drop a JComboBox from the toolbox and add the items you want to display without manually creating the code.
Open the Netbeans software using the shortcut icon in the Windows program group. Open your desktop or Web project after Netbeans loads.
Double-click the Java form you want to use to display the JComboBox. Drag and drop a combo box from the toolbox to the form. Netbeans automatically draws the combo box on the form. The JComboBox control automatically sizes as you add items into the selection area.
Double-click the JComboBox to open the Java class file. In this file you dynamically add items to the list.
Add the items to the selection list. For instance, the following code adds two color options to the JComboBox:
Click the "Save" button to save the changes to the Java form. Use your mouse to move the JComboBox around the form to place it in the exact location in which you want the control to display.