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

Setting negative size of JSplitPane divider leads to unexpected results.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 20
    • client-libs
    • None
    • behavioral
    • low
    • Applications which for some unknown reason depend on this unspecified behaviour will no longer be able to use it. This won't cause any run time exceptions etc, it would be limited to a UI rendering difference.
    • Java API
    • SE

      Summary

      Setting divider sizes < 0 in JSplitPane and BasicSplitPaneDivider in setDividerSize() should be ignored.

      Problem

      Setting the divider size to < 0 results in no divider being shown between the two components as should be done for JSplitPane components. This behavior is not specified and not intended or useful.

      Solution

      Update the implementation to ignore any attempt to set divider sizes < 0. Update the specification to document this new behavior.

      Specification

      class javax.swing.JSplitPane

         /**
                * Sets the size of the divider.
          +     * Divider sizes {@code newSize < 0}  are ignored.
                *
          public void setDividerSize(int newSize)

      class javax.swing.plaf.basic.BasicSplitPaneDivider

       /**
                * Sets the size of the divider to {@code newSize}. That is
                * the width if the splitpane is {@code HORIZONTAL_SPLIT}, or
                * the height of {@code VERTICAL_SPLIT}.
          +     * Divider sizes {@code newSize < 0} are ignored.
                *
                * @param newSize a new size
           public void setDividerSize(int newSize) {

            psadhukhan Prasanta Sadhukhan
            irasunw Ira Ira (Inactive)
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: