public void mouseDragged(MouseEvent e) { if (shouldIgnore(e)) { return; } repostEvent(e); CellEditor editor = grid.getCurrentCellEditor(); if (editor == null || editor.shouldSelectCell(e)) { Point p = e.getPoint(); int row = grid.rowAtPoint(p); int column = grid.columnAtPoint(p); // The autoscroller can generate drag events outside the Table's range. if ((column == -1) || (row == -1)) { return; } grid.changeSelection(row, column, false, true); } }
public void mouseDragged(MouseEvent event) { // System.out.println("MouseInputHandler.mouseDragged()"); if (shouldIgnore(event)) { return; } // if CTRL is pressed we are not interested in mouse drag events if (event.isControlDown()) { return; } repostEvent(event); CellEditor editor = grid.getCurrentCellEditor(); if (editor == null || editor.shouldSelectCell(event)) { Point p = event.getPoint(); if (startPoint == null) { startPoint = p; } if (previousPoint == null) { previousPoint = p; } int row = grid.rowAtPoint(p); int column = grid.columnAtPoint(p); // The autoscroller can generate drag events outside the Grid's range. if ((column == -1) || (row == -1)) { return; } // update selectionRegion if (selectionAlgorithm == null) { // for grid headers selectionAlgorithm = new GridSelectionAlgorithm(grid); } selectionAlgorithm.update(p, startPoint, previousPoint, selectionRegion); selectionRegionChanged(grid, selectionRegion, false); previousPoint = p; } }