javax.swing.JSplitPane#getOrientation ( )源码实例Demo

下面列出了javax.swing.JSplitPane#getOrientation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gate-core   文件: DocumentEditor.java
/**
 * TODO: to remove? doesn't seems to be used anywhere.
 */
protected void updateSplitLocation(JSplitPane split, int foo) {
  Component left = split.getLeftComponent();
  Component right = split.getRightComponent();
  if(left == null) {
    split.setDividerLocation(0);
    return;
  }
  if(right == null) {
    split.setDividerLocation(1);
    return;
  }
  Dimension leftPS = left.getPreferredSize();
  Dimension rightPS = right.getPreferredSize();
  double location =
      split.getOrientation() == JSplitPane.HORIZONTAL_SPLIT
          ? (double)leftPS.width / (leftPS.width + rightPS.width)
          : (double)leftPS.height / (leftPS.height + rightPS.height);
  split.setDividerLocation(location);
}
 
源代码2 项目: stendhal   文件: StyledSplitPaneUI.java
@Override
public int getMinimumDividerLocation(JSplitPane pane) {
	int leftMin = super.getMinimumDividerLocation(pane);
	Component second = pane.getRightComponent();
	if ((second != null) && second.isVisible()) {
		Dimension paneSize = splitPane.getSize();
		Dimension maxSize = second.getMaximumSize();
		Insets insets = pane.getInsets();
		if (pane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
			leftMin = Math.max(leftMin, paneSize.width - insets.right - maxSize.width);
		} else {
			leftMin = Math.max(leftMin, paneSize.height - insets.bottom - maxSize.height);
		}
		/*
		 * To avoid inconsistency with the maximum location, it would seem
		 * reasonable to do:
		 *
		 *	leftMin = Math.min(leftMin, getMaximumDividerLocation(pane));
		 *
		 * however, the parent already calls getMinimumDividerLocation()
		 * in getMaximumDividerLocation(), so that would be a good way
		 * to get a stack overflow.
		 */
	}
	return leftMin;
}
 
源代码3 项目: netbeans   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
源代码4 项目: netbeans   文件: JCompoundSplitPane.java
private Component getSecondComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getRightComponent();
    } else {
        return splitPane.getBottomComponent();
    }
}
 
源代码5 项目: netbeans   文件: ResultWindow.java
/**
 * Sets the layout orientation of the contained result pane.
 *
 * @param orientation the orientation (see {@link JSplitPane#VERTICAL_SPLIT}
 * and {@link JSplitPane#HORIZONTAL_SPLIT}) to set.
 */
public void setOrientation(int orientation) {
    for(JSplitPane view: viewMap.values()){
        if (view.getOrientation() != orientation) {
            view.setOrientation(orientation);
        }
    }
}
 
源代码6 项目: visualvm   文件: JCompoundSplitPane.java
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
源代码7 项目: seaglass   文件: SeaGlassSplitPaneUI.java
public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
    if (jc == splitPane && getLastDragLocation() != -1 && !isContinuousLayout() && !draggingHW) {
        if (jc.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
            paintDragDivider(g, getLastDragLocation(), 0, dividerSize - 1, splitPane.getHeight() - 1);
        } else {
            paintDragDivider(g, 0, getLastDragLocation(), splitPane.getWidth() - 1, dividerSize - 1);
        }
    }
}
 
源代码8 项目: HiJson   文件: MainView.java
private void changeLayout() {
    int selIndex = getTabIndex();
    if(selIndex < 0){
        return;
    }
    TabData selTabData = tabDataModel.getTab(selIndex);
    JSplitPane splitPane = (JSplitPane)selTabData.getComponent();
    if (splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT) {
        splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
        splitPane.setDividerLocation(0.45);
    } else {
        splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
        splitPane.setDividerLocation(0.45);
    }
}
 
源代码9 项目: beautyeye   文件: SplitPaneDividerBorder.java
public Insets getBorderInsets(Component c)
{
	Insets insets = new Insets(0, 0, 0, 0);
	if (c instanceof BasicSplitPaneDivider)
	{
		BasicSplitPaneUI bspui = ((BasicSplitPaneDivider) c)
				.getBasicSplitPaneUI();

		if (bspui != null)
		{
			JSplitPane splitPane = bspui.getSplitPane();

			if (splitPane != null)
			{
				if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
				{
					insets.top = insets.bottom = 0;
					insets.left = insets.right = 1;
					return insets;
				}
				// VERTICAL_SPLIT
				insets.top = insets.bottom = 1;
				insets.left = insets.right = 0;
				return insets;
			}
		}
	}
	insets.top = insets.bottom = insets.left = insets.right = 1;
	return insets;
}
 
源代码10 项目: dragonwell8_jdk   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码11 项目: TencentKona-8   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码12 项目: jdk8u60   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码13 项目: openjdk-jdk8u   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码14 项目: netbeans   文件: JSplitPaneSupport.java
/** This method calculates layout constraints for a component dragged
    * over a container (or just for mouse cursor being moved over container,
    * without any component).
    * @param container instance of a real container over/in which the
    *        component is dragged
    * @param containerDelegate effective container delegate of the container
    * @param component the real component being dragged, not needed here
    * @param index position (index) of the component in its container;
    *        not needed here
    * @param posInCont position of mouse in the container
    * @param posInComp position of mouse in the dragged component; not needed
    * @return new LayoutConstraints object corresponding to the position of
    *         the component in the container
    */
   @Override
   public LayoutConstraints getNewConstraints(Container container,
                                              Container containerDelegate,
                                              Component component,
                                              int index,
                                              Point posInCont,
                                              Point posInComp)
   {
       if (!(container instanceof JSplitPane))
           return null;

       JSplitPane splitPane = (JSplitPane) container;
       Dimension sz = splitPane.getSize();
       int orientation = splitPane.getOrientation();

JButton left  = (JButton) splitPane.getClientProperty(LEFT_TOP_BUTTON);
JButton right = (JButton) splitPane.getClientProperty(RIGHT_BOTTOM_BUTTON);

       if ( (left == null && right == null) || 
     (left != null && right != null) ) 
{	    	    
    String freePosition;        	    
           if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
               if (posInCont.x <= sz.width / 2) 
                   freePosition = JSplitPane.LEFT;
	else 
                   freePosition = JSplitPane.RIGHT;
           }
           else {				
               if (posInCont.y <= sz.height / 2) 
                   freePosition = JSplitPane.TOP;		
	else 
                   freePosition = JSplitPane.BOTTOM;
           }
           assistantParams = freePosition;
    return new SplitConstraints(freePosition);
}

       assistantParams = findFreePosition();
return new SplitConstraints(assistantParams);
   }
 
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码16 项目: openjdk-jdk9   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码17 项目: jdk8u-jdk   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码18 项目: openjdk-8-source   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码19 项目: jdk8u-jdk   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
源代码20 项目: jdk8u_jdk   文件: javax_swing_JSplitPane.java
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}