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

Several Swing core components prevent using them in wrapper classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 7
    • client-libs
    • None
    • b72
    • generic
    • generic

      Several Swing components, including JList and JTextPane implement methods from Scrollable interface the following way:

          // JList
          public boolean getScrollableTracksViewportWidth() {
      if (getParent() instanceof JViewport) {
      return (((JViewport)getParent()).getWidth() > getPreferredSize().width);
      }
      return false;
          }

      As you can see the return value of this method is dependent on
      the type of the parent component. It makes it impossible to create a transparent wrapper component to be inserted between JViewport and its view.

      We shouldn't hardcode the instanceof check of the parent and provide more flexible solution

      This is improtant for JLayer, the new component to be added to JDK 7

            alexp Alexander Potochkin (Inactive)
            alexp Alexander Potochkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: