當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。