[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-2d-dev
Subject: RFR: 8154846: SwingNode does not resize when content size constraints are changed
From: Prasanta Sadhukhan <psadhukhan () openjdk ! org>
Date: 2023-09-28 9:52:56
Message-ID: LR-jsopwbTrEzauQB4-J-5Nl-9Z5lR0WQ3yWWIudvYc=.23fd1cc4-a520-4cec-a509-7060f59e9bc6 () github ! com
[Download RAW message or body]
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.
-------------
Commit messages:
- 8154846: SwingNode does not resize when content size constraints are changed
Changes: https://git.openjdk.org/jdk/pull/15960/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15960&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8154846
Stats: 22 lines in 1 file changed: 4 ins; 18 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/15960.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15960/head:pull/15960
PR: https://git.openjdk.org/jdk/pull/15960
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic