On Wed, 4 Oct 2023 05:48:59 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:
> 
>   Register listener before component add

What puzzles me is that I am getting inconsistent results.
Run the test, see the button, clicked once - the button disappears.  Moved the 
window to another sceen - the button appears in the corner.  Clicked on the 
button - now I see two buttons (corrupted screen buffer)?

Of course, I might be doing something wrong.  My command line:


/Users/angorya/Projects/jdk/build/macosx-aarch64-client-release/jdk/bin/java 
-XX:+ShowCodeDetailsInExceptionMessages -ea 
-Djava.library.path=/Users/angorya/Projects/jfx3/jfx/rt/build/sdk/lib 
-Dfile.encoding=UTF-8 -p 
/Users/angorya/Projects/Test3/Test/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.base/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.controls/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.graphics/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.fxml/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.media/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.swing/bin:/Users/angorya/Projects/jfx3/jfx/rt/modules/javafx.web/bin
 -classpath 
/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-jupiter-api_5.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-jupiter-engine_5.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-jupiter-migrationsupport_5.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins
 
/junit-jupiter-params_5.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-commons_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-engine_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-launcher_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-runner_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-suite-api_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-suite-engine_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-platform-suite-commons_1.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/junit-vintage-engine_5.9.3.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.opentest4j_1.2.0.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.apiguardian.api_1.1.2.jar:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.junit_4.13.2.v20211018-1956.jar:/Applications/Eclipse.app/Contents/Ecli
 pse/plugins/org.hamcrest.core_1.3.0.v20180420-1519.jar --add-reads 
javafx.base=java.management --add-reads javafx.base=jdk.management 
--add-exports javafx.graphics/test.com.sun.javafx.pgstub=javafx.controls 
--add-exports javafx.base/test.com.sun.javafx.binding=javafx.controls 
--add-exports javafx.base/test.util.memory=javafx.controls --add-exports 
javafx.base/test.javafx.collections=javafx.controls --add-exports 
javafx.base/com.sun.javafx.property=javafx.graphics --add-exports 
javafx.base/test.util.memory=javafx.graphics --add-exports 
java.base/sun.security.util=javafx.graphics --add-reads 
javafx.base=java.management --add-reads javafx.base=jdk.management --add-reads 
javafx.base=java.management --add-reads javafx.base=jdk.management --add-reads 
javafx.fxml=javafx.controls --add-exports 
javafx.base/com.sun.javafx.collections=javafx.fxml --add-exports 
javafx.graphics/test.com.sun.javafx.pgstub=javafx.controls --add-exports 
javafx.base/test.com.sun.javafx.binding=javafx.controls --add-
 exports javafx.base/test.util.memory=javafx.controls --add-exports 
javafx.base/test.javafx.collections=javafx.controls --add-exports 
javafx.base/com.sun.javafx.property=javafx.graphics --add-exports 
javafx.base/test.util.memory=javafx.graphics --add-exports 
java.base/sun.security.util=javafx.graphics --add-reads 
javafx.base=java.management --add-reads javafx.base=jdk.management 
--add-exports javafx.base/com.sun.javafx=javafx.web --add-exports 
javafx.base/test.util.memory=javafx.web --add-reads javafx.web=java.management 
--add-reads javafx.base=java.management --add-reads javafx.base=jdk.management 
-m andy_test/goryachev.apps.AppTestLauncher


![Screenshot 2023-10-05 at 12 13 
45](https://github.com/openjdk/jdk/assets/107069028/82403999-bd36-428c-ae65-33a078551947)

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

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

Reply via email to