/**
   * 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);
    	    }* /
    	}
    }*/
  }