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


Java TreePath.getPathComponent方法代码示例

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


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

示例1: getMaxValue

import javax.swing.tree.TreePath; //导入方法依赖的package包/类
private long getMaxValue(int row, int val) {
    TreePath path = treeTable.getPathForRow(row);
    if (path == null) return Long.MIN_VALUE; // TODO: prevents NPE from export but doesn't provide the actual value!
    if (path.getPathCount() < 2) return 1;
    
    PrestimeCPUCCTNode node = (PrestimeCPUCCTNode)path.getPathComponent(1);
    if (val == 0) return Math.abs(node.getTotalTime0());
    else if (val == 1) return Math.abs(node.getTotalTime1());
    else return Math.abs(node.getNCalls());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CPUTreeTableView.java

示例2: getRowPathStr

import javax.swing.tree.TreePath; //导入方法依赖的package包/类
private String getRowPathStr(TreePath trp) {
    String pathStr = "";
    if (trp.getPathCount() > 1) {
        for (int i = 1; i < trp.getPathCount(); i++) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) trp.getPathComponent(i);
            TreeNodeUserObject userObject = (TreeNodeUserObject) node.getUserObject();
            pathStr = pathStr + userObject.getOriginalName() + "/";
        }
    }
    return pathStr;
}
 
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:12,代码来源:TreeUtil.java

示例3: valueChanged

import javax.swing.tree.TreePath; //导入方法依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent event) {
    TreePath path = event.getPath();
    if (path.getPathCount() >= 2) {
        DefaultMutableTreeNode node
            = (DefaultMutableTreeNode)path.getPathComponent(1);
        this.selected = (OptionGroup)node.getUserObject();
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:DifficultyDialog.java

示例4: getRowPathStr

import javax.swing.tree.TreePath; //导入方法依赖的package包/类
private String getRowPathStr(TreePath trp) {
	String pathStr = "";
	if (trp.getPathCount() > 1) {
		for (int i = 1; i < trp.getPathCount(); i++) {
			DefaultMutableTreeNode node = (DefaultMutableTreeNode) trp.getPathComponent(i);
			TreeNodeUserObject userObject = (TreeNodeUserObject) node.getUserObject();
			pathStr = pathStr + userObject.getOriginalName() + "/";
		}
	}
	return pathStr;
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:12,代码来源:TreeUtil.java

示例5: getFileForSelectedNode

import javax.swing.tree.TreePath; //导入方法依赖的package包/类
/**
 * Gets the file name form the selected path in the preview tree. Supposed
 * is that the name of file in the second element in the path
 *
 * @param tree Preview tree
 * @return File name related to selected node
 */
public String getFileForSelectedNode(JTreeOperator tree) {
    TreePath selectionPath = tree.getSelectionPath();
    Object pathComponent = selectionPath.getPathComponent(2);
    return getPreviewItemLabel(pathComponent);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:RefactoringTestCase.java


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