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


Java BasicTreeUI.getLeftChildIndent方法代码示例

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


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

示例1: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
private boolean isLocationInExpandControl( TreePath path, Point location ) {
   if( tree.getModel().isLeaf( path.getLastPathComponent() ) )
       return false;
   
   Rectangle r = tree.getPathBounds(path);
   int boxWidth = 8;
   Insets i = tree.getInsets();
   int indent = 0;
   
   if( tree.getUI() instanceof BasicTreeUI ) {
       BasicTreeUI ui = (BasicTreeUI)tree.getUI();
       if( null != ui.getExpandedIcon() )
           boxWidth = ui.getExpandedIcon().getIconWidth();
       
       indent = ui.getLeftChildIndent();
   }
   int boxX;
   if( tree.getComponentOrientation().isLeftToRight() ) {
       boxX = r.x - positionX - indent - boxWidth;
   } else {
       boxX = r.x - positionX + indent + r.width;
   }
   return location.getX() >= boxX && location.getX() <= (boxX + boxWidth);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TreeTable.java

示例2: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
protected boolean isLocationInExpandControl(@Nullable TreePath path, int mouseX) {
  if (path == null) return false;
  TreeUI ui = getUI();
  if (!(ui instanceof BasicTreeUI)) return false;
  BasicTreeUI treeUI = (BasicTreeUI)ui;
  if (!treeModel.isLeaf(path.getLastPathComponent())) {
    Insets insets = this.getInsets();
    int boxWidth = treeUI.getExpandedIcon() != null ? treeUI.getExpandedIcon().getIconWidth() : 8;
    int boxLeftX = treeUI.getLeftChildIndent() + treeUI.getRightChildIndent() * (path.getPathCount() - 1);
    if (getComponentOrientation().isLeftToRight()) {
      boxLeftX = boxLeftX + insets.left - treeUI.getRightChildIndent() + 1;
    }
    else {
      boxLeftX = getWidth() - boxLeftX - insets.right + treeUI.getRightChildIndent() - 1;
    }
    boxLeftX -= getComponentOrientation().isLeftToRight() ? (int)Math.ceil(boxWidth / 2.0) : (int)Math.floor(boxWidth / 2.0);
    return mouseX >= boxLeftX && mouseX < boxLeftX + boxWidth;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:Tree.java

示例3: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
protected boolean isLocationInExpandControl(@Nullable TreePath path, int mouseX) {
  if (path == null) return false;
  TreeUI ui = getUI();
  if (!(ui instanceof BasicTreeUI)) return false;
  BasicTreeUI treeUI = (BasicTreeUI)ui;
  if (!treeModel.isLeaf(path.getLastPathComponent())) {
    Insets insets = Tree.this.getInsets();
    int boxWidth = treeUI.getExpandedIcon() != null ? treeUI.getExpandedIcon().getIconWidth() : 8;
    int boxLeftX = treeUI.getLeftChildIndent() + treeUI.getRightChildIndent() * (path.getPathCount() - 1);
    if (getComponentOrientation().isLeftToRight()) {
      boxLeftX = boxLeftX + insets.left - treeUI.getRightChildIndent() + 1;
    }
    else {
      boxLeftX = getWidth() - boxLeftX - insets.right + treeUI.getRightChildIndent() - 1;
    }
    boxLeftX -= (getComponentOrientation().isLeftToRight() ? (int)Math.ceil(boxWidth / 2.0) : (int)Math.floor(boxWidth / 2.0));
    return (mouseX >= boxLeftX && mouseX < (boxLeftX + boxWidth));
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:Tree.java

示例4: getExpandControlRange

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
@Nullable
public static Range<Integer> getExpandControlRange(@NotNull final JTree aTree, @Nullable final TreePath path) {
  TreeModel treeModel = aTree.getModel();

  final BasicTreeUI basicTreeUI = (BasicTreeUI)aTree.getUI();
  Icon expandedIcon = basicTreeUI.getExpandedIcon();


  Range<Integer> box = null;
  if (path != null && !treeModel.isLeaf(path.getLastPathComponent())) {
    int boxWidth;
    Insets i = aTree.getInsets();

    if (expandedIcon != null) {
      boxWidth = expandedIcon.getIconWidth();
    }
    else {
      boxWidth = 8;
    }

    int boxLeftX = i != null ? i.left : 0;

    boolean leftToRight = aTree.getComponentOrientation().isLeftToRight();
    int depthOffset = getDepthOffset(aTree);
    int totalChildIndent = basicTreeUI.getLeftChildIndent() + basicTreeUI.getRightChildIndent();

    if (leftToRight) {
      boxLeftX += (path.getPathCount() + depthOffset - 2) * totalChildIndent + basicTreeUI.getLeftChildIndent() -
          boxWidth / 2;
    }
    int boxRightX = boxLeftX + boxWidth;

    box = new Range<Integer>(boxLeftX, boxRightX);
  }
  return box;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:TreeUtil.java

示例5: getRowX

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
public static int getRowX(JTree tree, int depth) {
  if (tree == null) return 0;
  final TreeUI ui = tree.getUI();
  if (ui instanceof BasicTreeUI) {
    final BasicTreeUI treeUI = ((BasicTreeUI)ui);
    return (treeUI.getLeftChildIndent() + treeUI.getRightChildIndent()) * depth;
  }

  final int leftIndent = UIUtil.getTreeLeftChildIndent();
  final int rightIndent = UIUtil.getTreeRightChildIndent();

  return (leftIndent + rightIndent) * depth;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:CommittedChangeListRenderer.java

示例6: getTreeHandleWidth

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
/**
 * If a negative number is returned, then all events that occur in the
 * leading margin will be forwarded to the tree and consumed.
 * 
 * @return the width of the tree handle if it can be determined, else -1
 */
protected int getTreeHandleWidth() {
    if (renderer.getUI() instanceof BasicTreeUI) {
        BasicTreeUI ui = (BasicTreeUI) renderer.getUI();
        return ui.getLeftChildIndent() + ui.getRightChildIndent();
    } else {
        return -1;
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXTreeTable.java

示例7: setUI

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
@Override
public void setUI(TreeUI ui) {
	super.setUI(ui);
	if (ui instanceof BasicTreeUI) {
		BasicTreeUI bui = (BasicTreeUI)ui;
		treeHandleWidth = bui.getLeftChildIndent() + bui.getRightChildIndent();
	} else {
		treeHandleWidth = -1;
	}
}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:11,代码来源:BasicTreeTableUI.java

示例8: getExpandControlRange

import javax.swing.plaf.basic.BasicTreeUI; //导入方法依赖的package包/类
@Nullable
public static Range<Integer> getExpandControlRange(@Nonnull final JTree aTree, @Nullable final TreePath path) {
  TreeModel treeModel = aTree.getModel();

  final BasicTreeUI basicTreeUI = (BasicTreeUI)aTree.getUI();
  Icon expandedIcon = basicTreeUI.getExpandedIcon();


  Range<Integer> box = null;
  if (path != null && !treeModel.isLeaf(path.getLastPathComponent())) {
    int boxWidth;
    Insets i = aTree.getInsets();

    if (expandedIcon != null) {
      boxWidth = expandedIcon.getIconWidth();
    }
    else {
      boxWidth = 8;
    }

    int boxLeftX = i != null ? i.left : 0;

    boolean leftToRight = aTree.getComponentOrientation().isLeftToRight();
    int depthOffset = getDepthOffset(aTree);
    int totalChildIndent = basicTreeUI.getLeftChildIndent() + basicTreeUI.getRightChildIndent();

    if (leftToRight) {
      boxLeftX += (path.getPathCount() + depthOffset - 2) * totalChildIndent + basicTreeUI.getLeftChildIndent() -
                  boxWidth / 2;
    }
    int boxRightX = boxLeftX + boxWidth;

    box = new Range<>(boxLeftX, boxRightX);
  }
  return box;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:TreeUtil.java


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