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

Need a way to programmatically stick JSplitPane divider under j2sdk 1.5

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Name: rmT116609 Date: 03/01/2004


      A DESCRIPTION OF THE REQUEST :
      Under previous versions of Java, if JSplitPane.setDividerLocation()
      moved the divider all the way to one side or another, it would
      "stick" there as the window was resized. Would like this to happen
      under 1.5. Even better would be to have a method of JSplitPane or
      SplitPaneUI that sticks the divider on request.



      JUSTIFICATION :
      Under previous Java versions, you could programmatically move a
      JSplitPane divider all the way to one side or the other, and it would
      "stick" there as the pane was resized. Under 1.5, the divider will not
      stick. This makes the interface behavior look sloppy.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some way to programmatically stick JSplitPane divider.
      ACTUAL -
      No way to do this.

      ---------- BEGIN SOURCE ----------

         // Under j2sdk 1.4, the divider will "stick" to the top;
         // under 1.5 it will not.

         import javax.swing.*;

          public class JSplitPaneIssue {
         
             public static void main(String args[]) {
               JFrame frame = new JFrame();
               JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
               split.setResizeWeight(.5);
               split.setTopComponent(new JLabel("top"));
               split.setBottomComponent(new JLabel("bottom"));
               frame.getContentPane().add(split);
               frame.setSize(400, 400);
               frame.setVisible(true);
               
               split.setDividerLocation(0);
               
               // Uncomment the rest to make it work under 1.5.
               /*Object ui = split.getUI();
               if(ui instanceof javax.swing.plaf.basic.BasicSplitPaneUI)
                  try {
                     java.lang.reflect.Method set_keep_hidden =
                        javax.swing.plaf.basic.BasicSplitPaneUI.class.getDeclaredMethod(
                        "setKeepHidden", new Class[] { boolean.class });
                     set_keep_hidden.setAccessible(true);
                     set_keep_hidden.invoke(ui, new Object[] { new Boolean(true) }); }
                      catch(Exception e) { }*/
            }
         
         }


      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use reflection to call BasicSplitPaneUI.setKeepHidden()
      (Incident Review ID: 240114)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: