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

Setting negative size of JSplitPane divider leads to unexpected results.

    XMLWordPrintable

Details

    • b17
    • x86, sparc
    • linux, solaris_8, windows_2000

    Description



      Name: iaR10016 Date: 12/26/2002


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.4.2-b11, JDK1.4.0, JDK1.4.1.

      JavaTM 2 Platform Std. Ed. v1.4.2 Specuification reads about JSplitPane.setDividerSize(int)
      method:
      ...
      public void setDividerSize(int newSize)
            Sets the size of the divider.
            Parameters:
                  newSize - an integer giving the size of the divider in pixels
      ...

      It does not specify the JSplitPane behavior if divider size is less then zero.

      In JDK1.4.2-b11 setting JSplitPane divider size to negative value leads to unexpected results.
      The following test example demonstrates the bug:

      --------- test.java ---------
      import javax.swing.*;
      import java.awt.*;

      public class test extends JFrame {
          public test() {
              super("JSplitPane test");
              JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
                       new JTextArea("I am top text area!"), new JTextArea("I am bottom text area!"));
              getContentPane().add(sp,BorderLayout.CENTER);
              sp.setDividerSize(-50);
          }

         public static void main(String[] args) {
              JFrame frame = new test();
              frame.setSize(new Dimension(400,200));
              frame.setVisible(true);
          }

      }
      -----------------------------

      Please, compile and run this example and than press Enter in the top text area.

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: