java - Javafx Choicebox - how to check if selected/activated -


i trying make simple app using javafx.

i want make choicebox, , when choicebox activated - meaning if value selected - want code progress.

this working:

if ( choicebox.getselectionmodel().isempty()){ } 

why opposite not work? :

if (! choicebox.getselectionmodel().isempty()){ } 

edit: have 2 layouts. 1 represents choicebox , 1 represents set of checkboxes. want accomplish checkboxes should appear when choicebox activated / value selected.

    if (! choicebox.getselectionmodel().isempty()){     secondlayout.setvisible(true);     } 

try this:

choicebox<string> cb = new choicebox(....);     secondlayout.visibleproperty().bind(bindings.createbooleanbinding(() -> cb.getvalue() != null, cb.valueproperty())); 

as alternative can do:

secondlayout.visibleproperty().bind(bindings.isnotnull(cb.valueproperty())); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -