On Fri, 6 Oct 2023 07:25:54 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.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Revalidate component after add

> so tested on windows 11 with your pre-built jdk and the latest fx master 
> branch.
> 
> What I see is some kind of behavior that happens when the code is missing 
> repaint() and/or validate(). When the window comes up first, it looks like 
> this - with the button not painted (a solid black block):
> 
> ![Screenshot 2023-10-12 
> 092011](https://user-images.githubusercontent.com/107069028/274665921-8a8299de-96c2-438e-8252-8a1dba608149.png)
> 
> a mouse over repaints the button (possibly due to hover?), or window resizing 
> repaints the button.
> 
> When I then click on the button, I see either 1/4 of the larger button where 
> it is supposed to be, or at the corner, like so: ![Screenshot 2023-10-12 
> 092024](https://user-images.githubusercontent.com/107069028/274666390-1f970dd4-ef9b-4ed4-94bf-2cc57b519b87.png)
> 
> resizing a window slightly places the button in the right spot and removes 
> all the artifacts.
> 
> All this happens on the primary screen with a 100% scale.

Yes, known issue...please refer 
[JDK-8298796](https://bugs.openjdk.org/browse/JDK-8298796)

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

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

Reply via email to