-
Notifications
You must be signed in to change notification settings - Fork 235
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
WebDateField fixed width ? #580
Comments
Resulting size of the field is either determined by it's preferred size (which usually makes sure that all information in the component is visible - text in the field in this case) or by it's container's layout. Looking at the screenshot - I'd guess that layout decides the field size in you case, so changing it's size will have no effect because size (and bounds which include size & location) only apply to containers with Changing field's preferred size might have effect, but it will depend on how your field's container layout distributes remaining space between it's components. In this particular I doubt it would have any effect either (except for maybe height of the field) because field is stretched by the layout already, meaning it ignores it's current smaller preferred size. There might also be some issues with field size calculation in theory, but I'm not seeing that happen on any demos I have, so I can't really help any further without knowing the code of the field and container you're using. |
Yes. The preferred size works. I use Q: how do I override the font and color of the textfield inside ? The setForeground() and setFont() below don't work :
|
- WebDateFieldUI.java - Basic Swing methods `setFont`, `setBackground` and `setForeground` are now forwarded from `WebDateField` to it's text field
- WebDateFieldUI.java - Added a better calculation of potential preferred field size
It's not possible in the latest released version, but I've added a small improvement that will forward Also, regarding the field length - I actually know why it becomes so lengthy now. It adjusts it's columns according to your date pattern. It's not the best solution because it makes fields really long in some cases. I've added some internal improvements for that, you might not need the custom preferred width anymore on newer version, for instance this is the new preferred size for your pattern: A few extra pixels are added to ensure text will fit in most cases, otherwise it stays really close to actual text width now. |
All the problems should be resolved with the next update, so i'll close this issue for now. |
Hi,
How do I reduce the width of the WebDateField ?
It doesn't adjust dynamically.
Currently it's too wide for my app.
See below the extra whitespace that I circle with a red oval :
How do I manually adjust it ?
I've tried
setSize(100, 30):
but it can't change the width.The text was updated successfully, but these errors were encountered: