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

JSplitPane needs isOneTouchExpanded()

XMLWordPrintable

    • Cause Known
    • x86
    • linux

      A DESCRIPTION OF THE REQUEST :
      It's not possible for the developer to tell, for certian, whether the JSplitPane is completely expanded or completely minimized -- i.e. if the divider location is snapped to one edge or another. This is important, when, for example, the program needs to decide whether to resize the pane or not -- i.e. before calling JSplitPane.resetToPreferredSizes().

      JUSTIFICATION :
      When, for example, one of the split panes is resizing, it's important NOT to resize it when the user has compressed or expanded the pane.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JSplitPage.isOneTouchExpanded() returns true if the pane has been snapped to one edge or the other.
      ACTUAL -
      The method does not currently exist.

      CUSTOMER SUBMITTED WORKAROUND :
      It's possible to check whether the divider is within some tolerance of the edge of the panel. This decides based upon the panel's width or height, and assumes some random tolerance which is certainly not compatible across different swing look and feels.

      final int arbitraryTolerance = 15;/*arbitrary tolerance -- in swing under linux it was 11, so we upped it just in case*/
      if (splitPane.getDividerLocation()==splitPane.getMaximumDividerLocation() || splitPane.getDividerLocation()>=splitPane.getHeight()-arbitraryTolerance)
      return;

      if (splitPane.getDividerLocation()==splitPane.getMinimumDividerLocation() || splitPane.getDividerLocation()<=arbitraryTolerance)
      return;

      splitPane.resetToPreferredSizes();
      ###@###.### 2005-1-24 18:09:51 GMT

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: