当前位置: 首页>>代码示例>>Java>>正文


Java JSplitPane.getOrientation方法代码示例

本文整理汇总了Java中javax.swing.JSplitPane.getOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java JSplitPane.getOrientation方法的具体用法?Java JSplitPane.getOrientation怎么用?Java JSplitPane.getOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JSplitPane的用法示例。


在下文中一共展示了JSplitPane.getOrientation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateSplitLocation

import javax.swing.JSplitPane; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:23,代码来源:DocumentEditor.java

示例2: setOrientation

import javax.swing.JSplitPane; //导入方法依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ResultWindow.java

示例3: getFirstComponent

import javax.swing.JSplitPane; //导入方法依赖的package包/类
private Component getFirstComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getLeftComponent();
    } else {
        return splitPane.getTopComponent();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JCompoundSplitPane.java

示例4: getSecondComponent

import javax.swing.JSplitPane; //导入方法依赖的package包/类
private Component getSecondComponent(JSplitPane splitPane) {
    if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
        return splitPane.getRightComponent();
    } else {
        return splitPane.getBottomComponent();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JCompoundSplitPane.java

示例5: getNewConstraints

import javax.swing.JSplitPane; //导入方法依赖的package包/类
/** 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);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:JSplitPaneSupport.java

示例6: validate

import javax.swing.JSplitPane; //导入方法依赖的package包/类
protected void validate(JSplitPane before, JSplitPane after) {
    int orientation = after.getOrientation();
    if (orientation != before.getOrientation())
        throw new Error("Invalid orientation: " + orientation);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:javax_swing_JSplitPane.java


注:本文中的javax.swing.JSplitPane.getOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。