selectedNode.getPreferredAction ().actionPerformed (new ActionEvent (this, ActionEvent.ACTION_PERFORMED, "")); } else { expandPath (getSelectionPath ());
selectedNode.getPreferredAction ().actionPerformed (new ActionEvent (this, ActionEvent.ACTION_PERFORMED, "")); } else { expandPath (getSelectionPath ());
public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath selectionPaths[] = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants( e.getTreePath() ); // Restructure the node super.treeStructureChanged( e ); // Expand previously expanded paths if ( expanded != null ) { while( expanded.hasMoreElements() ) { expandPath( (TreePath)expanded.nextElement() ); } } // Select previously selected paths if ( selectionPaths != null && selectionPaths.length > 0 ) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths( selectionPaths ); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible( selectionPaths[0] ); } } }
public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath selectionPaths[] = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants( e.getTreePath() ); // Restructure the node super.treeStructureChanged( e ); // Expand previously expanded paths if ( expanded != null ) { while( expanded.hasMoreElements() ) { expandPath( (TreePath)expanded.nextElement() ); } } // Select previously selected paths if ( selectionPaths != null && selectionPaths.length > 0 ) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths( selectionPaths ); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible( selectionPaths[0] ); } } }
@Override public void treeStructureChanged(TreeModelEvent e) { // Remember selections and expansions TreePath[] selectionPaths = getSelectionPaths(); java.util.Enumeration expanded = getExpandedDescendants(e.getTreePath()); // Restructure the node super.treeStructureChanged(e); // Expand previously expanded paths if (expanded != null) { while (expanded.hasMoreElements()) { expandPath((TreePath) expanded.nextElement()); } } // Select previously selected paths if ((selectionPaths != null) && (selectionPaths.length > 0)) { boolean wasSelected = isPathSelected(selectionPaths[0]); setSelectionPaths(selectionPaths); if (!wasSelected) { // do not scroll if the first selection path survived structure change scrollPathToVisible(selectionPaths[0]); } } }