當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultTreeModel.reload方法代碼示例

本文整理匯總了Java中javax.swing.tree.DefaultTreeModel.reload方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultTreeModel.reload方法的具體用法?Java DefaultTreeModel.reload怎麽用?Java DefaultTreeModel.reload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.tree.DefaultTreeModel的用法示例。


在下文中一共展示了DefaultTreeModel.reload方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import javax.swing.tree.DefaultTreeModel; //導入方法依賴的package包/類
public void init() {
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    root.removeAllChildren();
    for (String availableExchangeName : availableExchangeNames) {
        DefaultMutableTreeNode firstChild = new DefaultMutableTreeNode(availableExchangeName);
        Collection<CurrencyPair> currencyPairs = IdeaCurrencyApp.getInstance().getCurrencyPairs(availableExchangeName);
        for (CurrencyPair currencyPair : currencyPairs) {
            CheckedTreeNode secondChild = new CheckedTreeNode(currencyPair.toString());
            boolean selected = isSelected(availableExchangeName, currencyPair);
            secondChild.setChecked(selected);
            firstChild.add(secondChild);
            tree.expandPath(new TreePath(secondChild));
        }
        tree.expandPath(new TreePath(firstChild));
        root.add(firstChild);
    }
    model.reload();
    tree.treeDidChange();
    Util.expandAll(tree, new TreePath(root), true);
}
 
開發者ID:semihunaldi,項目名稱:IdeaCurrency,代碼行數:22,代碼來源:IdeaCurrencyConfigUI.java

示例2: updateJTree

import javax.swing.tree.DefaultTreeModel; //導入方法依賴的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: sortTree

import javax.swing.tree.DefaultTreeModel; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
public static void sortTree(PnlGuiConfig pnlGuiConfig, DefaultMutableTreeNode root, JTree treeTypes) {
	if (root != null) {
		Enumeration e = root.depthFirstEnumeration();
		while (e.hasMoreElements()) {
			DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
			if (!node.isLeaf()) {
				sort(node);   //selection sort
			}
		}
		
		//Atualizando a arvore
		if (updateTree) {
			TreePath treePath = treeTypes.getSelectionPath();
			DefaultTreeModel model = (DefaultTreeModel) treeTypes.getModel();
			model.reload();
			treeTypes.setSelectionPath(treePath);
			updateTree = false;
		}

		pnlGuiConfig.getPnlFieldCondition().ckDynamicClick();
	}
}
 
開發者ID:adelbs,項目名稱:ISO8583,代碼行數:24,代碼來源:SortTreeHelper.java

示例4: moveWithChildren

import javax.swing.tree.DefaultTreeModel; //導入方法依賴的package包/類
private void moveWithChildren(RelationTypeNode node, RelationTypeNode siblingNode, RelationTypeNode parent, int index) {

        final List<RelationTypeNode> children = new ArrayList<>();

        if (siblingNode.getChildCount() > 0) {

            Enumeration en = siblingNode.breadthFirstEnumeration();

            while (en.hasMoreElements()) {

                RelationTypeNode item = (RelationTypeNode) en.nextElement();
                children.add(item);
            }

            siblingNode.removeAllChildren();
        }

        parent.insert(siblingNode, index);

        children.forEach(i -> siblingNode.add(i));

        final DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        model.reload(parent);

        tree.setSelectedNode(node);
    }
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:27,代碼來源:RelationTreePanel.java


注:本文中的javax.swing.tree.DefaultTreeModel.reload方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。