private void maybeGrabSelection() { if (table.getSelectedRow() != -1) { // Grab selection ListSelectionModel rowSel = table.getSelectionModel(); ListSelectionModel colSel = table.getColumnModel().getSelectionModel(); if (!haveAnchor()) { // System.err.println("Updating from table's selection"); setSelection( rowSel.getAnchorSelectionIndex(), rowSel.getLeadSelectionIndex(), colSel.getAnchorSelectionIndex(), colSel.getLeadSelectionIndex()); } else { // System.err.println("Updating lead from table's selection"); setSelection( getRowAnchor(), rowSel.getLeadSelectionIndex(), getColAnchor(), colSel.getLeadSelectionIndex()); } // printSelection(); } }
private void setLeadFromTable() { setLead( table.getSelectionModel().getAnchorSelectionIndex(), table.getColumnModel().getSelectionModel().getAnchorSelectionIndex()); }