當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicTreeUI.getRightChildIndent方法代碼示例

本文整理匯總了Java中javax.swing.plaf.basic.BasicTreeUI.getRightChildIndent方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicTreeUI.getRightChildIndent方法的具體用法?Java BasicTreeUI.getRightChildIndent怎麽用?Java BasicTreeUI.getRightChildIndent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.plaf.basic.BasicTreeUI的用法示例。


在下文中一共展示了BasicTreeUI.getRightChildIndent方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例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 = 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

示例3: setTreeUIVariables

import javax.swing.plaf.basic.BasicTreeUI; //導入方法依賴的package包/類
private void setTreeUIVariables() {
    if (tree.getUI() instanceof BasicTreeUI) {
        BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();
        treeSignExtent = treeUI.getExpandedIcon().getIconWidth() / 2;
        treeSignRightMargin = treeUI.getRightChildIndent();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:JTreeTable.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.getRightChildIndent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。