예제 #1
0
 public int getHorizontalDivider() {
   int location =
       horizontalSplitPane.getSize().width
           - horizontalSplitPane.getInsets().left
           - horizontalSplitPane.getDividerSize()
           - horizontalSplitPane.getRightComponent().getWidth();
   double width = indexingFrame.getWidth();
   double proportionalLocation = location / width;
   // horizontalSplitPane.setDividerLocation(proportionalLocation);
   return location;
 }
예제 #2
0
 public int getVerticalDivider() {
   int location =
       verticalSplitPane.getSize().height
           - verticalSplitPane.getInsets().bottom
           - verticalSplitPane.getDividerSize()
           - verticalSplitPane.getBottomComponent().getHeight();
   double height = indexingFrame.getHeight();
   double proportionalLocation = location / height;
   //		verticalSplitPane.setDividerLocation(proportionalLocation);
   //		double check = verticalSplitPane.getDiv
   return location;
 }
예제 #3
0
  /** Size the divider to the currently selected panel's preferred Size */
  private void resizeSelectedComponent() {
    /*
     * Set default resize behavior based on the currently
     * selected panel's preferredSize setting
     */
    Component panel = tabbedPane.getSelectedComponent();
    // Make sure we're not being notified that we've deleted
    // the last panel
    int width = 0;
    if (panel != null && cytoPanelContainer instanceof JSplitPane) {
      JSplitPane jsp = (JSplitPane) cytoPanelContainer;
      // if the panel is 0x0, it's probably not created, yet
      if (panel.getSize().width == 0 && panel.getSize().height == 0) return;

      if (panel.getPreferredSize() != null) {
        width = panel.getPreferredSize().width;
      }

      if (compassDirection == CytoPanelName.WEST) {
        if (width > WEST_MAX_WIDTH) width = WEST_MAX_WIDTH;
        else if (width < WEST_MIN_WIDTH) width = WEST_MIN_WIDTH;
        jsp.setDividerLocation(width + jsp.getInsets().left + jsp.getInsets().right);
      } else if (compassDirection == CytoPanelName.EAST) {
        if (width > EAST_MAX_WIDTH) width = EAST_MAX_WIDTH;
        else if (width < EAST_MIN_WIDTH) width = EAST_MIN_WIDTH;

        jsp.setDividerLocation(
            jsp.getSize().width
                - jsp.getInsets().right
                - jsp.getInsets().left
                - jsp.getDividerSize()
                - width);
      }
      // TODO: What's the right thing to do with SOUTH?
    }
  }
예제 #4
0
  /**
   * Show the console. (Code simultes a one touch expanable click programmatically, see
   * BasicSplitPaneDivider.OneTouchActionHandler)
   */
  public void showConsole(boolean show) {
    boolean shown = isConsoleShown();

    // System.out.println(show+" "+shown);

    Insets insets = sp.getInsets();
    int lastloc = sp.getLastDividerLocation();
    int currentloc = sp.getUI().getDividerLocation(sp);
    int newloc = currentloc;
    BasicSplitPaneDivider divider = ((BasicSplitPaneUI) sp.getUI()).getDivider();

    if (show && !shown) {
      if (currentloc >= (sp.getHeight() - insets.bottom - divider.getHeight())) {
        int maxloc = sp.getMaximumDividerLocation();
        newloc = lastloc < maxloc ? lastloc : maxloc * 2 / 3;
      }
    } else if (!show && shown) {
      newloc = sp.getMaximumDividerLocation();
    }

    if (currentloc != newloc) {
      sp.setDividerLocation(newloc);
      sp.setLastDividerLocation(currentloc);
    }

    /*if(show)
    {
    	if(sp.getOrientation() == JSplitPane.VERTICAL_SPLIT)
    	{
    		if(currentLoc >= (sp.getHeight() - insets.bottom - divider.getHeight()))
    		{
    			int maxLoc = sp.getMaximumDividerLocation();
    			newLoc = Math.min(lastLoc, maxLoc);
    			//((BasicSplitPaneUI)sp.getUI()).setKeepHidden(false);
               }
    		/*else
    		{
    			newLoc = insets.top;
    			//sp.setKeepHidden(true);
    		}* /
    	}
    	else
    	{
    	    if(currentLoc >= (sp.getWidth() - insets.right - divider.getWidth()))
    	    {
    	    	int maxLoc = sp.getMaximumDividerLocation();
    	    	newLoc = Math.min(lastLoc, maxLoc);
    	    	//sp.setKeepHidden(false);
    	    }
    	    /*else
    	    {
    	    	newLoc = insets.left;
    	    	//splitPaneUI.setKeepHidden(true);
    	    }* /
    	}
    }
    else
    {
    	if(sp.getOrientation() == JSplitPane.VERTICAL_SPLIT)
    	{
    	    if(currentLoc == insets.top)
    	    {
    	    	int maxLoc = sp.getMaximumDividerLocation();
    	    	newLoc = Math.min(lastLoc, maxLoc);
    	    	//sp.getUI().setKeepHidden(false);
               }
    	    /*else
    	    {
    	    	newLoc = sp.getHeight() - divider.getHeight() - insets.top;
    	    	//splitPaneUI.setKeepHidden(true);
               }* /
    	}
    	else
    	{
    	    if(currentLoc == insets.left)
    	    {
    	    	int maxLoc = sp.getMaximumDividerLocation();
    	    	newLoc = Math.min(lastLoc, maxLoc);
    	    	//splitPaneUI.setKeepHidden(false);
               }
    	    /*else
    	    {
    	    	newLoc = sp.getWidth() - divider.getWidth() - insets.left;
    	    	//splitPaneUI.setKeepHidden(true);
    	    }* /
    	}
    }*/
  }