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


Java JTree.setSelectionPaths方法代码示例

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


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

示例1: setCellSelection

import javax.swing.JTree; //导入方法依赖的package包/类
private boolean setCellSelection(Properties[] properties) {
    JTree tree = (JTree) component;
    if (properties.length == 0) {
        tree.setSelectionRows(new int[0]);
        return true;
    }
    List<TreePath> paths = new ArrayList<TreePath>();
    for (Properties propertie : properties) {
        TreePath path = getPath(tree, propertie.getProperty("Path"));
        if (path != null) {
            paths.add(path);
        }
    }
    if (paths.size() != properties.length) {
        return false;
    }
    tree.setSelectionPaths(paths.toArray(new TreePath[paths.size()]));
    return true;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:JTreeJavaElement.java

示例2: updateJTree

import javax.swing.JTree; //导入方法依赖的package包/类
public static JTree updateJTree(JTree tree, TreeArrayList<?> data, ExpandedPaths ep) {
    ArrayList<String> expanded_paths = null;
    TreePath[] paths = null;
    if(ep != null) {
        expanded_paths = ep.getExpandedPaths(tree);
        paths = tree.getSelectionPaths();
    }
    DefaultMutableTreeNode top = getDefaultMutableTreeNodeOfHashMap(data);
    DefaultTreeModel model = new DefaultTreeModel(top);
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    model.reload(root);
    tree.setModel(model);
    if(ep != null) {
        ep.expandPaths(tree, expanded_paths);
        tree.setSelectionPaths(paths);
    }
    return tree;
}
 
开发者ID:Panzer1119,项目名称:JAddOn,代码行数:19,代码来源:JTreeUtils.java

示例3: restoreSelectedNodes

import javax.swing.JTree; //导入方法依赖的package包/类
static void restoreSelectedNodes(JTree tree, UIState uiState) {
    tree.setSelectionPaths(uiState.getSelectedPaths());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ProfilerTreeTable.java

示例4: restoreSelectionPaths

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * Sets selected paths to the previous path(s) saved by {@link #saveSelectionPath(TreePath)} or
 * ##{@link #saveSelectionPaths(TreePath[])}. Scrolls to the first selected path.
 *
 * @param tree
 *            The related tree, containing the path(s)
 */
public void restoreSelectionPaths(JTree tree) {
	if (selectedPaths != null) {
		tree.setSelectionPaths(selectedPaths);
		tree.scrollPathToVisible(tree.getSelectionPath());
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:RepositoryTreeUtil.java


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