How to determine if JComboBox is empty?

How to determine if JComboBox is empty? This is something like:

combobox.isEmpty()

+4
source share
3 answers

What happened to JComboBox.getItemCount() ? If this method returns 0 , the component is empty.

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

I assume you are looking for the getItemCount () method

0
source

Source: https://habr.com/ru/post/1395027/


All Articles