Java 8 TreeSelectionEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TreeSelectionEvent class.

This code example shows how to use the following methods:getPath
package org.freeplane.plugin.workspace.listener; 
 
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
 
import org.freeplane.plugin.workspace.model.AWorkspaceTreeNode; 
 
public class DefaultWorkspaceSelectionListener implements TreeSelectionListener {	
	public void valueChanged(TreeSelectionEvent event) {
	    AWorkspaceTreeNode node = (AWorkspaceTreeNode)(event.getPath().getLastPathComponent());
	    if(node instanceof TreeSelectionListener) {
        	((TreeSelectionListener)node).valueChanged(event);
        } 
	} 
} 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getNewLeadSelectionPath, getPath
    assertTrue(tree.selectionEquals(new String[]{path1_1, path2}));
  } 
 
  private static class SelectionListener extends EventLogger implements TreeSelectionListener {
    public void valueChanged(TreeSelectionEvent e) {
      if (e.getNewLeadSelectionPath() != null) {
        log("selection").add("path", e.getPath().toString());
      } 
    } 
  } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
package org.freeplane.plugin.workspace.listener; 
 
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
 
import org.freeplane.plugin.workspace.model.AWorkspaceTreeNode; 
 
public class DefaultWorkspaceSelectionListener implements TreeSelectionListener {	
	public void valueChanged(TreeSelectionEvent event) {
	    AWorkspaceTreeNode node = (AWorkspaceTreeNode)(event.getPath().getLastPathComponent());
	    if(node instanceof TreeSelectionListener) {
        	((TreeSelectionListener)node).valueChanged(event);
        } 
	} 
} 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
    private final static String PrefsKey = "BrowserTreePath";
 
    private final static TreeSelectionListener m_listener =
        new TreeSelectionListener() { 
            public void valueChanged( TreeSelectionEvent e ) { 
                updatePath( e.getPath(), "" ); 
            } 
        }; 
} 
/* vim:set et sw=4 ts=4: */ 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
            updateImage(path);
        } 
    } 
 
    public void valueChanged(TreeSelectionEvent event) {
        TreePath path = event.getPath();
        if (path != null) {
            updateImage(path);
        } 
    } 
 
    protected void paintComponent(Graphics g) {
        Rectangle clip = g.getClipBounds();
        g.fillRect(clip.x, clip.y, clip.width, clip.height);
    } 
 
    private void updateImage(TreePath path) {
        try { 
            FileNode node = (FileNode) path.getLastPathComponent();
            File file = node.getFile();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
            updateImage(path);
        } 
    } 
 
    public void valueChanged(TreeSelectionEvent event) {
        TreePath path = event.getPath();
        if (path != null) {
            updateImage(path);
        } 
    } 
 
    protected void paintComponent(Graphics g) {
        Rectangle clip = g.getClipBounds();
        g.fillRect(clip.x, clip.y, clip.width, clip.height);
    } 
 
    private void updateImage(TreePath path) {
        try { 
            FileNode node = (FileNode) path.getLastPathComponent();
            File file = node.getFile();
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
    DirectoryUpdater(final JTree tree) {
        tree.addTreeSelectionListener(this);
    } 
 
    public void valueChanged(TreeSelectionEvent event) {
        TreePath path = event.getPath();
        getViewport().removeAll();
        if (path != null) {
            FileNode node = (FileNode) path.getLastPathComponent();
            File file = node.getFile();
            ImageInfo info = ImageInfo.getInstanceFor(file);
            ImageMetadata meta = null;
            Exception error = null;
            try { 
                meta = info.getMetadata();
            } 
            catch (Exception e) {
                error = e;
            } 
            if (meta != null) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
     * Enables action when a root folder is selected. 
     */ 
    private class EnablementSelectionListener implements TreeSelectionListener {
 
        public void valueChanged(TreeSelectionEvent e) {
            Object obj = e.getPath().getLastPathComponent();
            if (obj instanceof File) {
                setEnabled(recursiveSharingPanel.isRoot(((File)obj)));
            } else { 
                setEnabled(false);
            } 
        } 
 
    } 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getPath
		DefinitionController.getInstance().setSelectedModuleId(moduleId);
	} 
 
	@Override 
	public void valueChanged(TreeSelectionEvent event) {
		TreePath path = event.getPath();
		AbstractDefineComponent selectedComponent = (AbstractDefineComponent) path
				.getLastPathComponent();
		if (selectedComponent.getModuleId() != DefinitionController
				.getInstance().getSelectedModuleId()) { 
			updateSelectedModule(selectedComponent.getModuleId());
		} 
		checkLayerComponentIsSelected(); 
	} 
	 
 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSource
	public DBTreeSelectionListener(AttrDescribable announcer) {
		this.announcer = announcer;
	} 
 
	public void valueChanged(TreeSelectionEvent e) {
		JTree tree = (JTree)e.getSource();
		 
		if (tree.isSelectionEmpty())
			return; 
		 
		DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
		 
		if(node.isLeaf()) {
			DBTreeNode columnNode = (DBTreeNode)node.getUserObject();
			String column = columnNode.toString();
			 
			DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent();
			DBTreeNode tableNode = (DBTreeNode)parent.getUserObject();
			String table = tableNode.toString();
			 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 TreeSelectionEvent Methods: