-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Set the default minimum size of date picker and time picker text field, based on current component settings. Allow programmer overrides of the horizontal and vertical size settings. #13
Comments
This section of conversation was moved from the "General Discussion" thread into "Issue 13", on 2may16. This conversation was relocated here because it has significant overlap with this issue. -Blake Hi Blake, sorry to bother you again, Hello Gittino, When you say "the content is cropped", are you talking about the text inside the component? By default, the date picker resizes itself to fit all contained components, including the buttons (which are enlarged by Nimbus), and including the font size chosen by the programmer. If you need a smaller date picker, you can force it to be smaller with the functions that you mentioned, but as you noticed, such forcing will crop the text. You can make the font smaller by choosing any font that you wish as the display font. Here's an example of changing the font:
The typical choice made by most programmers would be to (optionally) make the date picker bigger, but never to make it smaller than the defaults. If you wish to make it smaller without setting a maximum size or a preferred size, you would choose a normal or relatively small display font and you would probably not choose the Nimbus style for this component. Or else, you might set Nimbus to use smaller buttons as described here: https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/size.html I've never tried this with Nimbus but the Oracle documentations say that it's possible. (Nimbus is the only built-in look and feel that allows you to change your desired sizes.) warm regards, Actually my issue is not relative to the text cropping, I will better explain with two images. On the left there is a normal text field, as you see the font size fits perfectly on it, but the DatePicker's textfield is higher. It is also larger than my needs, inserting a date using the format dd/MM/yyyy there is unused empty space on its right. This is instead an example of what appens when I try to reduce the size of the datePicker. As you can see the entire button has been cropped out (but there is still wasted space after the text in the textfield) also the bottom border has been cropped but there is still a certain margin between the text and the border of the textfield that could be reduced. |
hello Gittino, The extra horizontal space after the date is an effect of of a known issue, (#13). What's happening is that the date picker layout currently specifies a minimum size of 125 pixels for the text field (and no maximum size). This size is big enough for most "long versions" of dates on the calendar month with the most characters (in English and other languages) similar to "September 29, 2016". When no minimum size is specified, the text field shrinks down to nothing, which would have been a bigger problem. The current design was basically a "good enough" layout choice to avoid a lot of extra premature coding. When issue #13 is fixed, the horizontal distance issue will be fixed as well. (Especially if the programmer is allowed to override the minimum size.) Assigning a "customized default" minimum horizontal size will require calculating the dimension from the programmers current date format, locale (language), the month with the greatest number of characters in the current language, the current font(s), and font metrics. This is not the simplest calculation in the world, which is why it was not built in to the library from beginning. However it is still doable. The planned programmer override will also allow for any more specific aesthetic desires. The extra vertical space is a side effect of the fact that the layout is designed so that the text field will always take up the same height as the button, combined with the situation that you are using Nimbus. As mentioned (by you, and in a previous issue by Taurendil above), Nimbus uses extraordinarily large buttons by default, plus a little extra invisible border around the button. To fix this problem without modifying LGoodDatePicker, you would need to reduce your button's vertical size, which is currently possible. I could also add a feature request to #13 to allow the text field to (optionally) be resized independently of the button. That (feature request) would allow the text field to be made smaller without shrinking the button. I'm thinking this proposed work is (still) classified as an enhancement rather than a bug. The current layout is working well for most developers, and even in your use case the layout is causing "extra" space rather than "not enough" space, which may not be a aesthetically ideal, but is preferred over the alternative. Still, I will move issue #13 higher on the "mental priority queue" for this library. warm regards, |
With the release of LGoodDatePicker 5.3.1, this enhancement is now implemented. See the release details for a description of the new features. |
Hi Blake, |
Hi Gittino, Just so you know, after you upgrade to 5.3.1, you probably would not need to manually change the width because the date picker now has a new default sizing behavior. It dynamically resizes itself to to this date format that is applied (and the locale and font). So with your previously described problem, the date picker would now be the appropriate size for your smaller numeric format. Let me know if this enhancement works for you. warm regards, |
Hi Gittino, With this change, I will now consider all parts of this issue completely fixed, (unless I hear otherwise from you or others). Thank you. |
Hi Blake, |
Set minimum size of date picker and time picker text field, based on the font metrics of the current display font, and the longest standard time string that would be output by the current display format.
This calculated minimum size should be the default. However, the programmer should be able to override this behavior to set their own minimum size if desired.
The text was updated successfully, but these errors were encountered: