<Swing Dev> RFR: 4916923: In MetalRootPaneUI, MetalRootLayout does not correctly calculate minimumsize

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Nov 5 04:09:57 UTC 2020


On Thu, 5 Nov 2020 04:04:10 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> I tried with 
>>  UIManager.setLookAndFeel(new MetalLookAndFeel());
>> JFrame frame = new JFrame();
>>                 frame.setSize(new Dimension(500, 800));
>>                 frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
>>                 //frame.pack();
>>                 frame.setVisible(true);
>>                 System.out.println("Layout: " + frame.getRootPane().getLayout());
>>                 System.out.println("PreferredSize " + frame.getRootPane().getPreferredSize());
>> but it seems tpWidth and tpHeight what is being changed is the width and height of MetalTitlePane which seems always comes as 23 for both no matter what frame size is set, so I guess using any variable will do but logically, it will be good to use "tpHeight" for height calculation.
>> If it is believed to continue with same logical but not technical error, I will close this PR without integrating.
>
> The bug submitter said that it is somehow affected his application. So I assume there is a way to trigger this bug in the MetalRootLayout.

>From MetalTitlePane.java, the same "height" is being used for width and height so the value is same for both.
private class TitlePaneLayout implements LayoutManager {
        public void addLayoutComponent(String name, Component c) {}
        public void removeLayoutComponent(Component c) {}
        public Dimension preferredLayoutSize(Container c)  {
            int height = computeHeight();
            return new Dimension(height, height);
        }

-------------

PR: https://git.openjdk.java.net/jdk/pull/433


More information about the swing-dev mailing list