You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In FlatLaf 2.2, this works as expected: the component's margins are precisely dictated by the new EmptyBorder(12, 12, 11, 11) set up by MetalFileChooserUI. You can measure pixels to convince yourself:
Starting with FlatLaf 2.3 however, there are 8 superfluous pixels of margin on the right:
I'm pretty sure that the culprit is this section of code, which repackages the topPanel, filePane, and bottomPanel in a wrapper JPanel, but forgets about the getAccessoryPanel() (AP). In addition, it increases the hgap of JFileChooser's BorderLayout from 0 to 8 in preparation for FlatLaf's shortcuts panel. Now, seeing that the empty AP is not repackaged but remains subject to JFileChooser's top-level BorderLayout with the constraint LINE_END, it becomes clear why there are exactly 8 additional pixels on the right.
I think the most straightforward solution is to simply not forget the AP, i.e.:
Component north = borderLayout.getLayoutComponent( BorderLayout.NORTH );
+ Component lineEnd = borderLayout.getLayoutComponent( BorderLayout.LINE_END );
Component center = borderLayout.getLayoutComponent( BorderLayout.CENTER );
Component south = borderLayout.getLayoutComponent( BorderLayout.SOUTH );
- if( north != null && center != null && south != null ) {+ if( north != null && lineEnd != null && center != null && south != null ) {
JPanel p = new JPanel( new BorderLayout( 0, 11 ) );
p.add( north, BorderLayout.NORTH );
+ p.add( lineEnd, BorderLayout.LINE_END );
p.add( center, BorderLayout.CENTER );
p.add( south, BorderLayout.SOUTH );
fc.add( p, BorderLayout.CENTER );
}
I've not tested this change myself, but I'm pretty certain it will resolve the issue.
Best,
Felix
The text was updated successfully, but these errors were encountered:
Consider the following minimal example, which draws a
JFileChooser
:In FlatLaf 2.2, this works as expected: the component's margins are precisely dictated by the
new EmptyBorder(12, 12, 11, 11)
set up byMetalFileChooserUI
. You can measure pixels to convince yourself:Starting with FlatLaf 2.3 however, there are 8 superfluous pixels of margin on the right:
I'm pretty sure that the culprit is this section of code, which repackages the
topPanel
,filePane
, andbottomPanel
in a wrapperJPanel
, but forgets about thegetAccessoryPanel()
(AP). In addition, it increases the hgap ofJFileChooser
'sBorderLayout
from 0 to 8 in preparation for FlatLaf's shortcuts panel. Now, seeing that the empty AP is not repackaged but remains subject toJFileChooser
's top-levelBorderLayout
with the constraintLINE_END
, it becomes clear why there are exactly 8 additional pixels on the right.I think the most straightforward solution is to simply not forget the AP, i.e.:
I've not tested this change myself, but I'm pretty certain it will resolve the issue.
Best,
Felix
The text was updated successfully, but these errors were encountered: