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

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Oct 8 06:54:36 UTC 2020


On Wed, 7 Oct 2020 23:54:47 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> MetalRootLayout class and methods are private but it is called from MetalRootPaneUI so we cannot delete it
>> but I could not find any ways to invoke MetalRootLayout methods from testcase.
>
> The MetalRootPaneUI installs the MetalRootLayout as a layout manager for the current JRootPane. And it should be used
> from the Container.preferredSize()

I tried following testcase snippet
               ```
 JRootPane r = new JRootPane();
                JFrame f = new JFrame();
                f.getRootPane().setUI(new MetalRootPaneUI());
                f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
                f.getRootPane().getUI().installUI(r);
                r.getContentPane().add(new JLabel("foo"));
                System.out.println("Preferred Size: " + r.getPreferredSize());
but it uses JRootPane.RootLayout layout manager and not MetalRootLayout so it calls Rootlayout.preferredLayoutSize and
not MetalRootLayout.preferredlayoutSize

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

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


More information about the swing-dev mailing list