How to Disable an Item in a Combobox in Java

Written by mike wallace
  • Share
  • Tweet
  • Share
  • Email

The Java programming language contains a library aimed at helping developers produce graphical user interfaces. This library is called Java Swing, and the NetBeans Integrated Development environment features a graphical editor for making Java Swing applications. You can use Java Swing to place "Combo Boxes" on an application. These boxes contain lists of items that can be selected from, and they are common on websites that ask for a country of origin. Sometimes you will find yourself with too many items in a "Combo Box." Luckily, you can easily disable any items held by the "Combo Box" using NetBeans.

Skill level:
Moderately Easy

Other People Are Reading

Things you need

  • Java Software Development Kit with NetBeans Integrated Development Environment (IDE) Bundle (see Resource for link)

Show MoreHide


  1. 1

    Load the NetBeans IDE by clicking on its program icon. When the program loads, navigate to "New" followed by New Project." Select "Java Desktop Application" from the list on the right-hand side of the screen. A new application window appears in the NetBeans visual editor window. To the right of this window, there is a toolbox pane labelled "Palette."

  2. 2

    Click on the item labelled "Combo Box" from the "Palette" toolbox.

  3. 3

    Move your mouse pointer over the empty application window. A "Combo Box" item will appear beneath your mouse pointer. Click the pointer to place the "Combo Box" anywhere within the application window.

  4. 4

    Right-click the "Combo Box," and then select "Properties" from the context menu that appears. A "Properties" window will appear.

  5. 5

    Locate the field labelled "Models" in the "Properties" window. This field contains all of the items enabled for this "Combo Box."

  6. 6

    Click on the button marked with an ellipsis. A window containing a list of all the items held by the "Combo Box" appears.

  7. 7

    Click on the item you wish to remove. Delete it by pressing the "Delete" or "Backspace" key.

  8. 8

    Press the "OK" button to save your changes and exit the window.

  9. 9

    Press the "F6" key to execute the program. An application window containing a "Combo Box" appears. Click on the "Combo Box" to reveal its menu of items. The item you removed is no longer present.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.