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

With the latest change, it behaves as expected on the primary retina screen.

However, something is wrong if I put it on the secondary monitor right after 
the launch: I am still getting inconsistent behavior, incorrect button 
location, and visual artifacts.

For example, one time there is no button after the first click.  The button 
appears when I resize the window.

Another time, the button is in the corner again and some visual artifacts are 
present (see the screenshots below).

Perhaps we need to update the scale somewhere?

![Screenshot 2023-10-06 at 10 28 
26](https://github.com/openjdk/jdk/assets/107069028/4c1a6dbf-8e27-477d-8a8f-96ca3eea6cf0)

![Screenshot 2023-10-06 at 10 28 
34](https://github.com/openjdk/jdk/assets/107069028/da1f2c4c-f237-462f-b62b-159ac388d716)

just in case, my monitor setup:

<img width="588" alt="Screenshot 2023-10-06 at 10 35 33" 
src="https://github.com/openjdk/jdk/assets/107069028/6a5637a9-3f91-4a76-904a-20201439c8ea";>

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

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

Reply via email to