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

SplitPane divider location algorithm annoyingly hard to override

XMLWordPrintable

      A DESCRIPTION OF THE REQUEST :
      First, JSplitPane does not look at maximum sizes when determining its possible locations; it only looks only at minimum sizes. I believe this should be fixed as well, but since it is working now I just thought I would override JSplitPane and/or the JSplitPaneUI so it would work how I need it to

      One might think that overriding the getMinimumDividerLocation and getMaximumDividerLocation would be the place to start for this, but it is not. These methods have no effect on dragging the split bar...the most common manipulation mechanism.

       To alter the behaviour, one needs to look in the BasicSplitPaneDivider class in the plaf packages. In here, the min and max logic is duplicated. There is a VerticalDragController that can be overridden, but to use a subclass, the mousePressed() method needs to be *copied* and the call to create the controller altered to use the subclass.

      The SplitPaneUI class is used in the method, but its min and max logic is not used.

      JUSTIFICATION :
      When trying to change the behaviour, one should not need to copy java source code. Doing so causes additional dependancies on the version of Java being used.

      Furthermore, duplicating the logic makes finding the target to override difficult, since there are actually two targets.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Use the UI's min and max methods, making it not necessary to override the divider. If that is not possible for some reason, at least have a createVerticalDragger() method so the mousePressed method does not need to be blatantly copied
      ACTUAL -
      See above

      ---------- BEGIN SOURCE ----------
      See javax.swing.plaf.basic.BasicSplitPaneUI and javax.swing.plaf.basic.BasicSplitPaneDivider
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Override and copy/paste

            Unassigned Unassigned
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: