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


Java DefaultMutableTreeNode.getAllowsChildren方法代碼示例

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


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

示例1: toggle

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
private boolean toggle(TreePath treePath) {
    
    if( treePath == null ) {
        return false;
    }

    Object o = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject();

    DefaultTreeModel dtm = (DefaultTreeModel)cfgTree.getModel();
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent();

    if ( o instanceof Item ) {
        Item item = (Item)o;
        
        if ( node.getAllowsChildren() ) {
            return false;
        }
        
        item.value = !item.value;            
        dtm.nodeChanged(node);
        dtm.nodeChanged(node.getParent());
        scs.notifyChanged();
    }
    
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:FmtSpaces.java

示例2: valueChanged

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath[] paths = getSelectionPaths();
	// If only one item has been selected, then change the text in the
	// description area
	if (paths == null) {
		return;
	}
	if (paths.length == 1) {
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0].getLastPathComponent();
		if (!node.getAllowsChildren()) {
			ClusterTreeLeaf leaf = (ClusterTreeLeaf) node.getUserObject();
			ObjectVisualizer viz = ObjectVisualizerService.getVisualizerForObject(clusterModel);
			viz.startVisualization(leaf.getId());
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:18,代碼來源:ClusterTreeVisualization.java

示例3: actionPerformed

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e)
{
	// Ask for name
	String name = (String) JOptionPane.showInputDialog(getParent(), s("dialog.newfolder.desc"),
		s("dialog.newfolder.title"), JOptionPane.PLAIN_MESSAGE, null, null, null);

	// Have they entered a name?
	if( name != null )
	{
		String path = rootFolder;

		// Check for selection
		if( !fileTree.isSelectionEmpty() )
		{
			TreePath selectionPath = fileTree.getSelectionPath();
			DefaultMutableTreeNode lastPathComponent = (DefaultMutableTreeNode) selectionPath
				.getLastPathComponent();

			if( lastPathComponent.getAllowsChildren() )
			{
				path = getSelectedPath(selectionPath);
			}
			else
			{
				path = getSelectedPath(selectionPath.getParentPath());
			}
		}
		service.createFolder(stagingID, path, name);

		fileTreeModel.reload();
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:34,代碼來源:EntityStagingFileViewer.java

示例4: isLeaf

import javax.swing.tree.DefaultMutableTreeNode; //導入方法依賴的package包/類
@Override
public boolean isLeaf(Object node)
{
	DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node;
	return !treeNode.getAllowsChildren();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:7,代碼來源:EntityStagingFileViewer.java


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