Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273356

JDesktopPane:getComponentCount() returns one extra than expected with GTKLookAndFeel

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No significant risk
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      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.

      Problem

      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.

      Solution

      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.

      Specification

      The specification for javax.swing.JComponent class is being updated as follow

      src/java.desktop/share/classes/javax/swing/JComponent.java

        * 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">

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pbansal Pankaj Bansal (Inactive)
              Reporter:
              kganapureddy Krushnareddy Ganapureddy
              Reviewed By:
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: