当前位置: 首页>>代码示例>>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;未经允许,请勿转载。