Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P3
-
Resolution: Fixed
-
Affects Version/s: 18
-
Fix Version/s: 18
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
Resolved In Build:b15
Description
It’s observed that, getting the component count of the JDesktopPane returns one extra component than expected, when run with -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel.
The spec of - https://download.java.net/java/early_access/jdk18/docs/api/java.desktop/java/awt/Container.html#getComponentCount()
"Gets the number of components in this panel."
Generally the Container(JDesktopPane) created fresh one does not expect any components by default.
If the behavior of the JDesktopPane:getComponentCount() varies based on Look and feel then this should be stated explicitly in spec.
Please find the code snipped to demonstrate the problem
JDesktopPane jDesktopPane = new JDesktopPane();
if (jDesktopPane.getComponentCount() == 0) {
System.out.println("Expected : no child components present");
} else {
System.out.println("Unexpected : by default the jDesktopPane has components size " + jDesktopPane.getComponentCount() + " And the child component is " + jDesktopPane.getComponent(0));
}
Observation:
=====
/scratch/jdk-cache/17/34/jdk-17/bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel JDesktopPaneCompTests
Unexpected : by default the jDesktopPane has components size 1 And the child component is javax.swing.plaf.synth.SynthDesktopPaneUI$TaskBar
/scratch/jdk-cache/17/34/jdk-17/bin/java JDesktopPaneCompTests
Expected : no child components present
The spec of - https://download.java.net/java/early_access/jdk18/docs/api/java.desktop/java/awt/Container.html#getComponentCount()
"Gets the number of components in this panel."
Generally the Container(JDesktopPane) created fresh one does not expect any components by default.
If the behavior of the JDesktopPane:getComponentCount() varies based on Look and feel then this should be stated explicitly in spec.
Please find the code snipped to demonstrate the problem
JDesktopPane jDesktopPane = new JDesktopPane();
if (jDesktopPane.getComponentCount() == 0) {
System.out.println("Expected : no child components present");
} else {
System.out.println("Unexpected : by default the jDesktopPane has components size " + jDesktopPane.getComponentCount() + " And the child component is " + jDesktopPane.getComponent(0));
}
Observation:
=====
/scratch/jdk-cache/17/34/jdk-17/bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel JDesktopPaneCompTests
Unexpected : by default the jDesktopPane has components size 1 And the child component is javax.swing.plaf.synth.SynthDesktopPaneUI$TaskBar
/scratch/jdk-cache/17/34/jdk-17/bin/java JDesktopPaneCompTests
Expected : no child components present
Attachments
Issue Links
- csr for
-
JDK-8273356 JDesktopPane:getComponentCount() returns one extra than expected with GTKLookAndFeel
-
- Closed
-