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


Java DefaultTreeModel.setRoot方法代码示例

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


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

示例1: refresh

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
/**
 * Updates the JTree with class files loaded from the current jar.
 */
public void refresh() {
	JarData jar = Recaf.INSTANCE.jarData;
	if (jar == null) {
		return;
	}
	// TODO: Expand new tree model to match the original
	// Root node
	String jarName = (jar.jar != null) ? jar.jar.getName() : "?";
	ASMTreeNode root = new ASMTreeNode(jarName, null);
	DefaultTreeModel model = new DefaultTreeModel(root);
	tree.setModel(model);
	// Iterate classes
	List<String> names = Streams.sortedNameList(jar.classes.keySet());
	for (String className : names) {
		if (!jar.classes.containsKey(className)) {
			continue;
		}
		ClassNode node = jar.classes.get(className);
		// Create directory path based on current node name.
		ArrayList<String> dirPath = new ArrayList<String>(Arrays.asList(node.name.split("/")));
		// Create directory of nodes
		Swing.generateTreePath(root, dirPath, node, model);
	}
	model.setRoot(root);
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:29,代码来源:JarFileTree.java

示例2: setLogModel

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
public void setLogModel(Model value) {
	this.logModel = value;

	DefaultTreeModel model = (DefaultTreeModel) getModel();
	CircuitNode curRoot = (CircuitNode) model.getRoot();
	CircuitState state = logModel == null ? null : logModel.getCircuitState();
	if (state == null) {
		if (curRoot != null)
			model.setRoot(null);
		return;
	}
	if (curRoot == null || curRoot.circuitState != state) {
		curRoot = new CircuitNode(null, state, null);
		model.setRoot(curRoot);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:ComponentSelector.java

示例3: createTreeModel

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
private TreeModel createTreeModel(DocumentModel dm) {
    DocumentElement rootElement = dm.getRootElement();
    DefaultTreeModel dtm = new DefaultTreeModel(null);
    TreeNodeAdapter rootTna = new TreeNodeAdapter(rootElement, dtm, tree, null);
    dtm.setRoot(rootTna);
    
    return dtm;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:NavigatorContent.java

示例4: setup

import javax.swing.tree.DefaultTreeModel; //导入方法依赖的package包/类
/**
 * Setup and return the tree model for a search.
 *
 * @return
 */
private DefaultTreeModel setup() {
	JarData jar = Recaf.INSTANCE.jarData;
	String jarName = (jar.jar != null) ? jar.jar.getName() : "?";
	ASMTreeNode root = new ASMTreeNode(jarName, null);
	DefaultTreeModel model = new DefaultTreeModel(root);
	model.setRoot(root);
	return model;
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:14,代码来源:SearchPanel.java


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