sshahine / JFoenix

JavaFX Material Design Library
MIT License
6.27k stars 1.05k forks source link

DatePicker expands horizontally infinitely #1245

Open Bawnorton opened 1 year ago

Bawnorton commented 1 year ago

Adding a JFXDatePicker to any pane programmatically or via fxml causes it to gradually expand horizontally infinitely regardless of any constraints set on the date picker or the pane.

The Datepicker remains completely functional, see video below.

https://user-images.githubusercontent.com/18416784/181114767-ce93bc91-e618-425e-90e7-6895b52ec34f.mov

Android-X13 commented 1 year ago

Are you on a Mac by any chance?

Does this work: datePicker.getEditor().setMaxWidth(Control.USE_PREF_SIZE);

Bawnorton commented 1 year ago

Are you on a Mac by any chance?

Does this work:

datePicker.getEditor().setMaxWidth(Control.USE_PREF_SIZE);

Yes on Mac, I fixed it by setting max, min and preferred size to a fixed value. Not setting one of these causes the bug, which doesn't seem to make a whole lot of sense. I couldn't find the source of the bug in the library but the aforementioned fix seemed to resolve the issue.

adiora commented 1 year ago

Setting the font size to an odd number worked for me. weird though.

preland commented 5 months ago

Here are some of the findings I found on this issue while working on this issue:

-Width isn't modified at instantiation; this means that setting MaxWidth for the element changes nothing except for the starting point of the growth -Growth isn't constrained or influenced by window size -For some reason, the growth will become paused when moved from a higher resolution monitor to a lower resolution monitor. In addition, the issue doesn't seem to occur on the lower resolution at all (1080p). The growth continues Most (see next) of the time when moved back to a higher resolution. -Sometimes, when moved from lower to higher resolution quickly, the growth will remain stopped. The growth continues once the window is updated in any way (a button is clicked, a pop-up occurs, etc.) -I could not find a way to reduce or reset the size of the datePicker after growth. Moving to another screen would stop it, but it would continue from the same size once looked at again. Restarting is the only way to (temporarily) return the size back to normal.

Hope this helps!