RFR: 8154846: SwingNode does not resize when content size constraints are changed

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Oct 5 16:23:27 UTC 2023


On Wed, 4 Oct 2023 05:47:39 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> SwingNode does not update its internal cache of Swing pref/max/min height and widths when its JComponent content's corresponding size constraints are updated. As such, it isn't resized to honor those size constraints. 
>> 
>> JLightweightFrame does install a PropertyChangeListener for "preferredSize", "maximumSize", and "minimumSize" properties, but this only happens via a ContainerListener which is not added until after the content has already been added to the content pane, and since the application cannot call this methods directly as per the documentation for the SwingNode.resize() method: `Applications should not invoke this method directly. If an application needs to directly set the size of the SwingNode, it should set the Swing component's minimum/preferred/maximum size constraints which will be propagated correspondingly to the SwingNode and it's parent will honor those settings during layout.`
>> 
>> so the fix is to add the listener as soon as the component is added to the JLightweightFrame's content.
>
> Fix is updated to register listener before component is added/removed.
> 
> @andy-goryachev-oracle @aghaisas Can you please review this FX fix?
> 
> There is some SwingNode rendering issue still due to [JDK-8298796](https://bugs.openjdk.org/browse/JDK-8298796) but size update issue should be fixed..

> @prsadhuk Pre-submit tests - windows-x64 / build - Build / test Failing after 75m — 1/2 failed

Not sure on this..The failure says which has nothing to do with the change..


 Output from failing command(s) repeated here ===
* For target jdk_modules_java.management.rmi__the.java.management.rmi_batch:
IOException caught during compilation: Connection reset

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

PR Comment: https://git.openjdk.org/jdk/pull/15960#issuecomment-1749254612


More information about the client-libs-dev mailing list