如何检测JComboBox是否为空?

如何检测JComboBox是否为空? 是这样的:

combobox.isEmpty()

JComboBox.getItemCount()什么问题? 如果此方法返回0 ,则组件为空。

 if(JComboBox.getItemCount() != 0){ //JComboBox is not empty - do something.. } 

我想你正在寻找getItemCount()方法