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


Java JTree.isExpanded方法代码示例

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


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

示例1: configure

import javax.swing.JTree; //导入方法依赖的package包/类
/** Configures a tree cell renderer and sets up sizing and the 
 * backing image from it */
public boolean configure (Object nd, JScrollPane tv, JTree tree, TreePath path, int row) {
    boolean sameVn = setLastRendereredObject(nd);
    boolean sameComp = setLastRenderedScrollPane (tv);
    Component renderer = null;
    bg = tree.getBackground();
    boolean sel = tree.isSelectionEmpty() ? false :
        tree.getSelectionModel().isPathSelected(path);
    boolean exp = tree.isExpanded(path);
    boolean leaf = !exp && tree.getModel().isLeaf(nd);
    boolean lead = path.equals(tree.getSelectionModel().getLeadSelectionPath());
    renderer = tree.getCellRenderer().getTreeCellRendererComponent(tree, nd, sel, exp, leaf, row, lead);
    if (renderer != null) {
        setComponent (renderer, tree);
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ViewTooltips.java

示例2: saveExpansionState

import javax.swing.JTree; //导入方法依赖的package包/类
/**
 * Saves the currently selected paths and saves all expanded repositories and nodes.
 *
 * @param tree
 *            The related tree, containing the path(s)
 */
public void saveExpansionState(JTree tree) {

	saveSelectionPaths(tree.getSelectionPaths());

	expandedNodes = new HashSet<>();
	expandedRepositories = new HashSet<>();

	for (int i = 0; i < tree.getRowCount(); i++) {
		TreePath path = tree.getPathForRow(i);
		if (tree.isExpanded(path)) {
			Entry entry = (Entry) path.getLastPathComponent();
			String absoluteLocation = entry.getLocation().getAbsoluteLocation();
			if (entry instanceof Repository) {
				expandedRepositories.add(absoluteLocation);
			} else {
				expandedNodes.add(absoluteLocation);
			}

		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:RepositoryTreeUtil.java

示例3: getExpandedPaths

import javax.swing.JTree; //导入方法依赖的package包/类
public static ArrayList<String> getExpandedPaths(JTree tree) {
    ArrayList<String> paths_expanded = new ArrayList<>();
    for(int i = 0; i < tree.getRowCount(); i++) {
        TreePath tp = tree.getPathForRow(i);
        if(tree.isExpanded(i)) {
            paths_expanded.add(tp.toString());
        }
    }
    return paths_expanded;
}
 
开发者ID:Panzer1119,项目名称:JAddOn,代码行数:11,代码来源:JTreeUtils.java


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