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


Java TreeSelectionEvent.getSource方法代码示例

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


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

示例1: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
/************ imple of TreeSelectionListener *******/

@Override
public void valueChanged(TreeSelectionEvent e) {
    showPopupCompletion = false;
    FileSystemView fsv = fileChooser.getFileSystemView();
    JTree tree = (JTree) e.getSource();
    TreePath path = tree.getSelectionPath();
    TreePath curSel = e.getNewLeadSelectionPath();
    curSelPath = (curSel != null) ? new WeakReference<TreePath>(curSel) : null;
    
    if(path != null) {
        
        DirectoryNode node = (DirectoryNode)path.getLastPathComponent();
        File file = node.getFile();
        
        if(file != null) {
            setSelected(getSelectedNodes(tree.getSelectionPaths()));
            newFolderAction.setEnabled(false);
            
            if(!node.isLeaf()) {
                newFolderAction.enable(file);
                setDirectorySelected(true);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:DirectoryChooserUI.java

示例2: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
public void valueChanged(TreeSelectionEvent arg0) {
		if ( arg0.getSource() == tree ) {
			if ( arg0.isAddedPath() ) {
//				System.out.println("Added selection path");
				openTreePaths.add(arg0.getPath());
			} else {
//				System.out.println("Removed selection path");
			}
		}
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:11,代码来源:AccessAllData.java

示例3: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
@Override
public void valueChanged(final TreeSelectionEvent e)
{
	if( e.getSource() == tree )
	{
		GlassSwingWorker<TLEGroup> worker = new GlassSwingWorker<TLEGroup>()
		{
			@Override
			public TLEGroup construct()
			{
				GroupTreeNode node = getSelectedGroupNode();
				if( node == null )
				{
					return null;
				}
				else
				{
					return groupService.get(node.getId());
				}
			}

			@Override
			public void finished()
			{
				final TLEGroup g = get();

				details.loadGroup(g, new TreeUpdateName()
				{
					@Override
					public void update(String name)
					{
						updateTreeName(e.getOldLeadSelectionPath(), name);
					}
				});
				updateGui();
			}

			@Override
			public void exception()
			{
				getException().printStackTrace();
			}
		};
		worker.setComponent(this);
		worker.start();
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:48,代码来源:GroupsTab.java

示例4: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
	tree = (JTree) e.getSource();
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:5,代码来源:JavaTreeListener.java


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