@Override public void valueChanged( final TreeSelectionEvent event ) { selectionChanged( tree.getMinSelectionRow() >= 0 ); } } );
public void valueChanged(TreeSelectionEvent treeSelectionEvent) { JTree treeSource = (JTree) treeSelectionEvent.getSource(); System.out.println("Min: " + treeSource.getMinSelectionRow()); System.out.println("Max: " + treeSource.getMaxSelectionRow()); System.out.println("Lead: " + treeSource.getLeadSelectionRow());
public void valueChanged(TreeSelectionEvent treeSelectionEvent) { JTree treeSource = (JTree) treeSelectionEvent.getSource(); System.out.println("Min: " + treeSource.getMinSelectionRow()); System.out.println("Max: " + treeSource.getMaxSelectionRow()); System.out.println("Lead: " + treeSource.getLeadSelectionRow());
public void valueChanged(TreeSelectionEvent treeSelectionEvent) { JTree treeSource = (JTree) treeSelectionEvent.getSource(); System.out.println("Min: " + treeSource.getMinSelectionRow()); System.out.println("Max: " + treeSource.getMaxSelectionRow()); System.out.println("Lead: " + treeSource.getLeadSelectionRow());
/** * Save tree expanded and selected state * * @param guiPackage {@link GuiPackage} to be used * @return {@link TreeState} */ public static TreeState from(GuiPackage guiPackage) { if (guiPackage == null) { return NOTHING; } MainFrame mainframe = guiPackage.getMainFrame(); if (mainframe != null) { final JTree tree = mainframe.getTree(); int savedSelected = tree.getMinSelectionRow(); ArrayList<Integer> savedExpanded = new ArrayList<>(); for (int rowN = 0; rowN < tree.getRowCount(); rowN++) { if (tree.isExpanded(rowN)) { savedExpanded.add(rowN); } } return new TreeStateImpl(savedSelected, savedExpanded); } return NOTHING; }
for ( int i = mtree.getMinSelectionRow(); i <= mtree.getMaxSelectionRow(); i++ ) { NetworkTreeNode n = (NetworkTreeNode) mtree.getPathForRow(i).getLastPathComponent(); if ( n != null && n.getUserObject() != null && mtree.isRowSelected(i) )
for (int i = tree.getMinSelectionRow(); i <= tree.getMaxSelectionRow(); i++) { NetworkTreeNode tn = (NetworkTreeNode) tree.getPathForRow(i).getLastPathComponent();