-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
focusWidth isn't being properly taken into account for component size or painting #317
Comments
This is normal behavior. It is a feature of MigLayout called "visual padding". FlatLaf tells MigLayout (via client property) the insets of the "invisible" space around a component (e.g. the focus border in IntelliJ/Darcula themes) and MigLayout then ignores the invisible space while computing its grid layout. Following screenshot shows "FlatLaf IntelliJ" theme on left side (with focusWidth = 2) With the help of MigLayout "visual paddings", the layout in the FlatLaf Demo stays stable when you switch from IntelliJ to Light theme: Generally this is a great feature, but it has the problem that MigLayout places the component partly outside of its container if the container does not have insets. IMHO MigLayout should take this into account and avoid placing components partly outside of container. To fix this either use insets for the container:
or disable visual padding for the container:
See: https://www.formdev.com/jformdesigner/doc/layouts/miglayout-whitepaper/#layout_cons_novisualpadding |
Thanks very much Karl, especially for going to so much effort in your reply! I've never had to deal with visual padding before in MigLayout, but that makes sense. It does surprise me that MigLayout is able to essentially place components outside of their container -- although I do see how it makes the layout stable between LnF changes. A PR to improve MigLayout would probably help to ease confusion for other users. I'll just use insets for now. |
I'm loving FlatLaf, having only recently discovered it, but I'm having some painting issues when using the IntelliJ theme, which has a focusWidth of 2.0.
When I place various components (JButtons, JSpinners, etc) into a panel with no insets (using MigLayout("ins 0")), the outer border of the components is not being fully drawn. For example:
I'm on Windows 10, AdoptOpenJDK 11, using FlatLaf 1.1.2.
Here's an SSCCE that shows the issue:
I haven't looked into the code too much, sorry, hence I'm not sure if it's a problem with the preferred size being incorrect, or with the painting not being offset correctly.
The text was updated successfully, but these errors were encountered: