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

Specification of BasicSplitPaneDivider::getMinimumSize,getPreferredSize doesn't match with its behavior.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P2 P2
    • 17
    • client-libs
    • None
    • behavioral
    • minimal
    • No behavior change - specification only so minimal risk
    • Java API
    • SE

      Summary

      The current specification of

      api/java.desktop/javax/swing/plaf/basic/BasicSplitPaneDivider.html#getPreferredSize().

      and

      api/java.desktop/javax/swing/plaf/basic/BasicSplitPaneDivider.html#getMinimumSize()

      does not match with the current implementation.

      Problem

      api/java.desktop/javax/swing/plaf/basic/BasicSplitPaneDivider.html#getPreferredSize()

      and

      api/java.desktop/javax/swing/plaf/basic/BasicSplitPaneDivider.html#getMinimumSize() specifies that these methods returns dividerSize x dividerSize value but in reality it returns dividerSize x 1 or 1 x dividerSize depending on the splitpanedivider's orientation

      Solution

      Rectified the specification of these methods to specify correct returned values.

      Specification

           /**
      -     * Returns dividerSize x dividerSize
      +     * Returns the preferred size of the divider.
      +     * @implNote In current implementation,
      +     * if the splitpane is HORIZONTAL_SPLIT, the preferred size is obtained from
      +     * width of {@code getDividerSize} pixels and height of 1 pixel
      +     * If the splitpane is VERTICAL_SPLIT, the preferred size is obtained from
      +     * height of {@code getDividerSize} pixels and width of 1 pixel
      +     *
      +     * @return a {@code Dimension} object containing the preferred size of
      +     *         {@code BasicSplitPaneDivider}
            */
           public Dimension getPreferredSize() {
      
            /**
      -     * Returns dividerSize x dividerSize
      +     * Returns the minimum size of the divider.
      +     * @implNote In current implementation,
      +     * if the splitpane is HORIZONTAL_SPLIT, the minimum size is obtained from
      +     * width of {@code getDividerSize} pixels and height of 1 pixel
      +     * If the splitpane is VERTICAL_SPLIT, the minimum size is obtained from
      +     * height of {@code getDividerSize} pixels and width of 1 pixel
      +     *
      +     * @return a {@code Dimension} object containing the minimum size of
      +     *         {@code BasicSplitPaneDivider}
            */
           public Dimension getMinimumSize() {

            psadhukhan Prasanta Sadhukhan
            amadgundi Asha Madgundi (Inactive)
            Alexander Zuev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: