java - Is there a way to check if a ComboBox has any items in JavaFX? -
is there way check if combobox
has items in or whether empty? have array of combobox
es , need go through each of them, if there no items in combobox
, must hide it. following code doesn't seem work:
for (combobox cmb : comboboxes) { if (cmb.getitems().isempty()) { cmb.hide(); } }
the .getitems()
method returns observablelist<t>
can check .size()
. tell if it's empty.
for (combobox cmb : comboboxes) { if (cmb.getitems().size() <= 0) { // or cmb.getitems().isempty() cmb.setvisible(false); } }
if combobox
populated list
of own, check if list empty same .size()
call.
Comments
Post a Comment