本文整理汇总了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());
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}