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

Add setting to make JSplitPane divider non-resizable

    XMLWordPrintable

Details

    Description

      A DESCRIPTION OF THE REQUEST :
      There are some cases (see below) where the resizing capability of JSplitPane is of no use, but the one-touch expansion buttons are useful, and make a better GUI than the JTabbedPane or custom alternative.

      This is a very minor inconvenience, but would add a bit more flexibility for GUI developers.

      JUSTIFICATION :
      We have a simple JFrame with a few filter fields (JTextField) on the top of a JSplitPane, and a result JTree on the bottom. The filter area is a fixed size, but the JTree may grow. Resizing the JSplitPane to give more area to the top filter area is of no use... it just expands the space around the fields and makes the JTree panel smaller. And the top area can't be made any smaller than the default size, so the JSplitPane doesn't allow it to be sized smaller.

      However, it is sometimes useful to completely hide the fields panel, so the JTree has more room.

      Using a JTabbedPane (one for the fields and one for the JTree) is the obvious alternative, but has some drawbacks. If the JFrame is stretched to give the JTree tab more room, then the fields tab gets stretched too, an doesn't look as good regardless of layout.

      The only other alternative would be a custom GUI with a button to show/hide the filter panel. Since the JSplitPane can already do this with the one-touch expansion buttons, it would be nice to reuse that component instead.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would like to see a JSplitPane.setDividerResizable(boolen tf) method. The default would be 'true' (current functionality), but if set to 'false', the divider would not react to drag events. The divider might also be rendered differently to indicate that it can't be dragged, e.g. maybe the dots along the divider would be removed.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Imported:
              Indexed: