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

LayerUI.getScrollableTracksViewportHeight/Width work incorrectly

    Details

      Description

      The spec for method javax.swing.plaf.LayerUI.getScrollableTracksViewportHeight() says:

          /**
           * Returns {@code false} to indicate that the height of the viewport does not
           * determine the height of the layer, unless the preferred height
           * of the layer is smaller than the height of the viewport.
           */

      Failing JCK tests:
      api/javax_swing/plaf/LayerUI/index.html#General[getScrollableTracksViewportHeight_viewPort]
      api/javax_swing/plaf/LayerUI/index.html#General[getScrollableTracksViewportWidth_viewPort]

      Platform: ALL
      JDK 7 b75: FAIL
      JDK 7 b70: PASS


      Please see the following minimized code below (for getScrollableTracksViewportHeight, getScrollableTracksViewportWidth behaves the same way):
      ----------------------------------------------------------------
      import javax.swing.*;
      import javax.swing.plaf.LayerUI;
      import java.awt.*;

      /**
       * Verifies that method returns false to indicate that the height of the viewport does not
       * determine the height of the layer, unless the preferred height
       * of the layer is smaller than the height of the viewport
       */
      public class LayerUI_getSTVpHeight {
          public static void main(String[] args) {
              int layerPrefSizeHeight = 50;
              final int vpHeight = 100;
              JLayer layer = new JLayer();
              layer.setPreferredSize(new Dimension(0, layerPrefSizeHeight));
              JViewport viewport = new JViewport() {
                  @Override
                  public int getHeight() {
                      return vpHeight;
                  }
              };
              viewport.setView(layer);
              System.out.println("vpHeight > layerPrefSizeHeight = " + (vpHeight > layerPrefSizeHeight));
              System.out.println("getScrollableTracksViewportHeight(layer) = " +
                      new LayerUI().getScrollableTracksViewportHeight(layer));
          }
      }
      ----------------------------------------------------------------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alexp Alexander Potochkin (Inactive)
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: