Closed DJViking closed 5 years ago
I've taken a look and indeed, the time is not initialized. Need to look into this further.
Ok. Interesting. This is as-expected. Let me try to explain.
In your code, with the setCalendar commented out, the picked date is actually null. The date picking part of the UI always shows a month's worth of day buttons, but a date need not be selected (allowNull is true). So what you see are 30 days, today highlighted, but no date selected.
The time picking part always shows a number of sliders, depending on what can be set (hour, minutes, etc), but in the case of a null value they're all left and there is no text. And that is what you see. The sliders need to be present, just like the day buttons, because you need to be able to set a value. The instant you slide a slider, a value is set (you also see that happening in the date when the slider is released).
Try running your code with setAllowNull(false).
So the actual issue here is that "null" is not rendered very clearly in the timepicker. Need to think about how to improve that.
Not setting a Calendar for CalendarPicker, the shown date and time with setAllowNull(false) are now both showing current date/time.
CalendarPicker picker = new CalendarPicker();
picker.setShowTime(true);
picker.setAllowNull(false);
However with LocalDateTimeTextField, this will not work. java.lang.IllegalArgumentException: Empty string would result in null and that is not allowed
Correct. If allow null is false, then "now" is populated per default.
I've just added showing the empty symbol (Ø) when null is the value in time picker. Nightly build will push that out as 8.0-r7-SNAPSHOT in 20 minutes. Let me know how that works out for you.
Where can I find this new SNAPSHOT? It is not in Maven central repository.
Snapshots are never in maven central, but in Sonatype's OSS repository. https://oss.sonatype.org/#nexus-search;gav~org.jfxtras~jfxtras-controls~~~~kw,versionexpand
CalendarPicker does not show time if Calendar is not set
Without setting Calendar the current date is showing on the CalendarPicker, but not current time.
jfxtras-controls-8.0-r6