Update the JComponent specification to denote that a JComponent may contain any number of initial or default components as children. This behaviour may also vary according to Look and Feel being used. For a particular Look and Feel also, this behaviour may change according to the configuration properties.
It is being assumed incorrectly that any JComponent instance created should not have any children unless they have been added by the application and therefore, should return zero if getComponentCount is called on it. This assumption is incorrect as JComponent specification is not clear on whether a JComponent can/can't have default or initial components.
Update the JComponent specification to clarify that a JComponent can have any number of initial/default components. This behaviour may also vary according to Look and Feel being used. For a particular Look and Feel also, this behaviour may change according to the configuration properties.
The specification for javax.swing.JComponent class is being updated as follow
* need a specific value for a particular property you should * explicitly set it. * <p> + * A <code>JComponent</code> may contain any number of default or initial + * components as children. This behaviour may change according to look and + * feel, therefore a <code>JComponent</code> may contain some default or + * initial components as children for a particular Look and Feel, whereas it + * may not do so for some other Look and Feel. Within a particular Look and + * Feel also, this behaviour may change depending upon the configuration + * properties of the <code>JComponent</code>. In summary, it is not valid + * to assume a JComponent has no children just because the application + * did not directly add them. + * <p> * In release 1.4, the focus subsystem was rearchitected. * For more information, see * <a href="https://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html">
- csr of
JDK-8272148 JDesktopPane:getComponentCount() returns one extra than expected with GTKLookAndFeel