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

Cant drag mulitple JSplitPane's downward

XMLWordPrintable

      FULL PRODUCT VERSION :
      jdk1.4.2_02
      Jdk1.5

      ADDITIONAL OS VERSION INFORMATION :
      Windows-XP

      A DESCRIPTION OF THE PROBLEM :
      I have a class in which i have added JSplitPane's into a JPanel. Now i can move multiple splitpanes upward but not downward. It seems splitpane can see the area above that but not down area.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Multiple Splitpanes should be draged downward
      ACTUAL -
      Multiple splitpanes can be dragged upward but not downward

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class LayeredPane extends JPanel {

      private java.util.List splitList = new java.util.ArrayList();
      private int orientation = JSplitPane.VERTICAL_SPLIT;
      private JSplitPane lastSplit = null;
      private Component lastComponent = null;
      private boolean isEmpty = true;
      public static int iLocation =0;

      /**
      * Make a new <tt>LayeredPane</tt> with the specified orientation, which
      * needs to be either <tt>JSplitPane.VERTICAL_SPLIT</tt> or
      * <tt>JSplitPane.HORIZONTAL_SPLIT</tt>
      *
      * @param orientation the orientation of the layers
      */
      public LayeredPane(int orientation) {
      super(new BorderLayout());
      if (orientation != JSplitPane.VERTICAL_SPLIT
      && orientation != JSplitPane.HORIZONTAL_SPLIT) {
      throw new IllegalArgumentException(
      "Invalid parameter to LayeredPane, must be"
      + "either JSplitPane.VERTICAL_SPLIT or JSplitPane.HORIZONTAL_SPLIT");
      }
      this.orientation = orientation;
      }

      public void removeLayer(Component component) {
      Component toRemove = null;
      Component toKeep = null;
      for (Iterator iter = splitList.iterator(); iter.hasNext();) {
      JSplitPane sp = (JSplitPane) iter.next();

      sp.setBorder(new EmptyBorder(0, 0, 0, 0));
      Component tc = sp.getTopComponent();
      Component bc = sp.getBottomComponent();
      if (component.equals(tc)) {
      toRemove = tc;
      toKeep = bc;
      break;
      } else if (component.equals(bc)) {
      toRemove = bc;
      toKeep = tc;
      break;
      }
      }
      if (toRemove != null && toKeep != null) {
      Container parent = toRemove.getParent().getParent();
      parent.remove(toRemove.getParent());
      parent.add(toKeep);
      }
      }

      /**
      * Add a layer to the <tt>LayeredPane</tt> that contains the component specified.
      * The new layer will be added as the topmost, or leftmost component in the <tt>LayeredPane</tt>
      * @param component the object to put in the new layer.
      */
      public void addLayer(Component component) {
      if (isEmpty) {
      add(component);
      lastComponent = component;
      isEmpty = false;
      return;
      } else if (lastSplit == null) {
      JSplitPane sp = new JSplitPane(orientation);

      sp.setBorder(new EmptyBorder(0, 0, 0, 0));
      sp.setBottomComponent(lastComponent);
      sp.setTopComponent(component);
      lastSplit = sp;

      splitList.add(sp);
      lastComponent = component;
      this.add(sp, BorderLayout.CENTER);
      return;
      } else {
      JSplitPane splitPane = new JSplitPane(orientation);
      splitPane.setBorder(new EmptyBorder(0, 0, 0, 0));
      lastSplit.setTopComponent(splitPane);
      splitPane.setBottomComponent(lastComponent);
      splitPane.setTopComponent(component);
      splitList.add(splitPane);
      lastSplit = splitPane;
      lastComponent = component;
      }


      }

      public void initSplitPane(Integer[] paneBnds)
      {

      for(int ii=0;ii<=paneBnds.length-1;ii++)
      {
      int divLoc = paneBnds[ii].intValue();
      ((JSplitPane)splitList.get(ii)).setDividerLocation(divLoc);
      }


      }
      static int counter = 0;
      public java.util.List getPanelList(){
      return splitList;
      }



      }

      Here we are creating the object of this layered pane.

      public void initNestedPanel()

         {

          m_nestedPane = new LayeredPane(JSplitPane.VERTICAL_SPLIT);
         // JScrollPane scroll = new JScrollPane(lp);
          Vector vec = this.m_ButtonPane.getButtons();
        Integer[] paneBnds =(Integer[])
      m_doc.getPref(EFSigniture.ICCMGR_SRVRPANESIZE);

           for (int ii = (tables.size()-1); ii >=0 ; ii --)

         {
              JPanel panel = new JPanel();
              panel.setLayout(new BorderLayout());
              panel.setBorder(BorderFactory.createEtchedBorder());
              JPanel buttonComp = getButtonPanel((Component)vec.elementAt(ii));
              panel.add(buttonComp ,BorderLayout.WEST);
              panel.add((Component)tables.elementAt(ii),BorderLayout.CENTER);
      panel.setMinimumSize(new
      Dimension(this.getWidth()-60,110+(SystemConfiguration.isMacOS()?10:0)));
              //m_nestedPane.addLayer((Component)tables.elementAt(ii) );
              m_nestedPane.addLayer((Component)panel );
         }
      }

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

            mlapshin Mikhail Lapshin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: