java - DatePicker setEditable to false still allows for clicking of Calendar -
i trying seteditable datepicker false value cannot changed. using following disables text field, still allows changing of date clicking on calendar button (the seteditable permissions, can enable/disable depending on login):
exampledatepicker.seteditable(user.getgroup().equals(admin));
is there way disable calendar button on datepicker? don't want use setdisable, still want field readable, , can't change css disabled because have other datepickers disabled want greyed out.
to disable (i.e make behave it's disabled), call setdisable(...)
:
exampledatepicker.setdisable(! user.getgroup().equals(admin));
to change appearance default disabled (which agree hard read), can still use css, choose datepicker
specifically. easiest way use css pseudoclass:
pseudoclass notauthenticated = pseudoclass.getpseudoclass("not-authenticated"); exampledatepicker.setdisable(! user.getgroup().equals(admin)); exampledatepicker.pseudoclassstatechanged(notauthenticated, ! user.getgroup().equals(admin));
and in external css can set styles .date-picker:not-authenticated
, e.g.:
.date-picker:not-authenticated, .date-picker:not-authenticated > .text-field { -fx-opacity: 0.85 ; }
i recommend making date picker little different active (not disabled) date picker, or else may confusing user.
Comments
Post a Comment