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

JSplitPane spliter has wrong size

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: yyT116575 Date: 07/11/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      JsplitPane splitter takes up too much space.

      Run the following sample:
      package test;

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class GUI extends JFrame {
          JPanel contentPane;
          BorderLayout borderLayout1 = new BorderLayout();
          JSplitPane jSplitPane1 = new JSplitPane();
          JTabbedPane jTabbedPane1 = new JTabbedPane();
          JTabbedPane jTabbedPane2 = new JTabbedPane();
          JScrollPane jScrollPane1 = new JScrollPane();
          JTable jTable1 = new JTable();
          JScrollPane jScrollPane2 = new JScrollPane();
          JTable jTable2 = new JTable();
          JTable jTable3 = new JTable();
          JScrollPane jScrollPane3 = new JScrollPane();
          JScrollPane jScrollPane4 = new JScrollPane();
          JTable jTable4 = new JTable();
          JTable jTable5 = new JTable();

          /**Construct the frame*/
          public GUI() {
              enableEvents(AWTEvent.WINDOW_EVENT_MASK);
              try {
                  jbInit();
              }
              catch(Exception e) {
                  e.printStackTrace();
              }
          }
          /**Component initialization*/
          private void jbInit() throws Exception {
               contentPane = (JPanel) this.getContentPane();
              contentPane.setLayout(borderLayout1);
              this.setSize(new Dimension(400, 300));
              this.setTitle("Frame Title");
              jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
              contentPane.add(jSplitPane1, BorderLayout.CENTER);
              jSplitPane1.add(jTabbedPane1, JSplitPane.LEFT);
              jTabbedPane1.add(jScrollPane3, "jScrollPane3");
              jScrollPane3.getViewport().add(jTable4, null);
              jTabbedPane1.add(jScrollPane4, "jScrollPane4");
              jScrollPane4.getViewport().add(jTable5, null);
              jSplitPane1.add(jTabbedPane2, JSplitPane.RIGHT);
              jTabbedPane2.add(jScrollPane1, "jScrollPane1");
              jTabbedPane2.add(jScrollPane2, "jScrollPane2");
              jScrollPane2.getViewport().add(jTable3, null);
              jScrollPane1.getViewport().add(jTable1, null);
          }
      }

      package test;

      import javax.swing.UIManager;
      import java.awt.*;

      public class TestMain {
          boolean packFrame = false;

          /**Construct the application*/
          public TestMain() {
              GUI frame = new GUI();
              //Validate frames that have preset sizes
              //Pack frames that have useful preferred size info, e.g. from their layout
              if (packFrame) {
                  frame.pack();
              }
              else {
                  frame.validate();
              }
              //Center the window
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              Dimension frameSize = frame.getSize();
              if (frameSize.height > screenSize.height) {
                  frameSize.height = screenSize.height;
              }
              if (frameSize.width > screenSize.width) {
                  frameSize.width = screenSize.width;
              }
              frame.setLocation((screenSize.width - frameSize.width) / 2,
      (screenSize.height - frameSize.height) / 2);
              frame.setVisible(true);
          }
          /**Main method*/
          public static void main(String[] args) {
              try {
                  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              }
              catch(Exception e) {
                  e.printStackTrace();
              }
              new TestMain();
          }
      }
      (Review ID: 127840)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apikalev Andrey Pikalev
                Reporter:
                yyoungsunw Yung-ching Young (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: