RFR: 4765299: componentResized() not always called with nested JSplitPanes

Tejesh R tr at openjdk.org
Mon Jan 12 11:01:58 UTC 2026


On Tue, 6 Jan 2026 10:53:31 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> If a component "comp" be nested inside a "inner" JSplitPane with VERTICAL_SPLIT mode and if then "inner" be nested inside a
> "outer" JSplitPane with HORIZONTAL_SPLIT mode and a component listener is added to "comp"
> then with this setup, componentResized() on the listener is called ONLY when the divider of "outer" is moved manually
> however, it is not called when the divider of "outer" is moved using "One touch expandable" left button at the top of the divider.
> 
> This is because the `layoutContainer` bails out if the width or height is 0 which logically should be to bail out if both width and height is 0 and when "One touch expandable" left button is pressed, width becomes 0 so `layoutContainer` bails out without sending the event.
> 
> With this fix, componentResized is called
> 
> No regression is observed in CI.

I hope you have tested manual tests too. I verified the changes in Swingset2 and no regressions found.

test/jdk/javax/swing/JSplitPane/TestSplitPaneCompResize.java line 55:

> 53:     private JSplitPane outer;
> 54:     private static JButton leftOneTouchButton;
> 55:     private static JButton rightOneTouchButton;

`rightOneTouchButton`  can be local variable.

test/jdk/javax/swing/JSplitPane/TestSplitPaneCompResize.java line 135:

> 133: 
> 134:             if (!resized) {
> 135:                 throw new RuntimeException("ComponetResized not called");

Suggestion:

                throw new RuntimeException("ComponentResized not called");

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

PR Review: https://git.openjdk.org/jdk/pull/29063#pullrequestreview-3650179930
PR Review Comment: https://git.openjdk.org/jdk/pull/29063#discussion_r2681756844
PR Review Comment: https://git.openjdk.org/jdk/pull/29063#discussion_r2681760297


More information about the client-libs-dev mailing list