Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

choice boxs remove all

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
CA
I am new to Java and need to empty out a choice box when the user presses a command button

I have the action listener working but am unsure of the syntax to empty out the choice box

thanks
 
Assuming you are using a JComboBox, you can use the following lines of code (without the first line, IE and NS may throw an exception).

if (comboBox.getItemCount() > 0)
comboBox.removeAllItems();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top