On Thu, 28 Sep 2023 09:43:25 GMT, Prasanta Sadhukhan <psadhuk...@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.

This pull request has now been integrated.

Changeset: 37eb9860
Author:    Prasanta Sadhukhan <psadhuk...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/37eb98604f4e2c241d959c7e2b337beb047421da
Stats:     16 lines in 1 file changed: 9 ins; 7 del; 0 mod

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

Reviewed-by: prr, angorya, arapte

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

PR: https://git.openjdk.org/jdk/pull/15960

Reply via email to