List of usage examples for javax.swing.tree TreeSelectionModel addSelectionPath
void addSelectionPath(TreePath path);
From source file:com.mirth.connect.client.ui.DashboardPanel.java
/** * Shows the popup menu when the trigger button (right-click) has been pushed. Deselects the * rows if no row was selected./*from w ww . jav a 2 s. c o m*/ */ private void checkSelectionAndPopupMenu(MouseEvent event) { TreePath path = dashboardTable.getPathForLocation(event.getX(), event.getY()); /* * On mouse events we don't need to update the dashboard panel plugins. They will already * have been updated because of the ListSelectionEvent, and multiple mouse events will enter * here (as many as three, one pressed and two released) so we would basically be doing four * times the work. */ if (path == null) { deselectRows(false); } else { updatePopupMenu(false); } if (event.isPopupTrigger()) { TreeSelectionModel selectionModel = dashboardTable.getTreeSelectionModel(); if (!selectionModel.isPathSelected(path)) { deselectRows(false); selectionModel.addSelectionPath(path); } parent.dashboardPopupMenu.show(event.getComponent(), event.getX(), event.getY()); } }