113 |
ListSelectionModel rowModel = table.getSelectionModel(); |
ListSelectionModel rowModel = table.getSelectionModel(); |
114 |
if (lo_row != -1 && hi_row != -1) |
if (lo_row != -1 && hi_row != -1) |
115 |
{ |
{ |
116 |
if (controlPressed && rowModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) |
if (controlPressed && rowModel.getSelectionMode() |
117 |
|
!= ListSelectionModel.SINGLE_SELECTION) |
118 |
rowModel.addSelectionInterval(lo_row, hi_row); |
rowModel.addSelectionInterval(lo_row, hi_row); |
119 |
else |
else |
120 |
rowModel.setSelectionInterval(lo_row, hi_row); |
rowModel.setSelectionInterval(lo_row, hi_row); |
125 |
{ |
{ |
126 |
int lo_col = table.columnAtPoint(begin); |
int lo_col = table.columnAtPoint(begin); |
127 |
int hi_col = table.columnAtPoint(curr); |
int hi_col = table.columnAtPoint(curr); |
128 |
ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); |
ListSelectionModel colModel = table.getColumnModel(). |
129 |
|
getSelectionModel(); |
130 |
if (lo_col != -1 && hi_col != -1) |
if (lo_col != -1 && hi_col != -1) |
131 |
{ |
{ |
132 |
if (controlPressed && colModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) |
if (controlPressed && colModel.getSelectionMode() != |
133 |
|
ListSelectionModel.SINGLE_SELECTION) |
134 |
colModel.addSelectionInterval(lo_col, hi_col); |
colModel.addSelectionInterval(lo_col, hi_col); |
135 |
else |
else |
136 |
colModel.setSelectionInterval(lo_col, hi_col); |
colModel.setSelectionInterval(lo_col, hi_col); |
159 |
{ |
{ |
160 |
begin = new Point(e.getX(), e.getY()); |
begin = new Point(e.getX(), e.getY()); |
161 |
curr = new Point(e.getX(), e.getY()); |
curr = new Point(e.getX(), e.getY()); |
162 |
updateSelection(e.isControlDown()); |
//if control is pressed and the cell is already selected, deselect it |
163 |
|
if (e.isControlDown() && table. |
164 |
|
isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin))) |
165 |
|
{ |
166 |
|
table.getSelectionModel(). |
167 |
|
removeSelectionInterval(table.rowAtPoint(begin), |
168 |
|
table.rowAtPoint(begin)); |
169 |
|
table.getColumnModel().getSelectionModel(). |
170 |
|
removeSelectionInterval(table.columnAtPoint(begin), |
171 |
|
table.columnAtPoint(begin)); |
172 |
|
} |
173 |
|
else |
174 |
|
updateSelection(e.isControlDown()); |
175 |
|
|
176 |
} |
} |
177 |
public void mouseReleased(MouseEvent e) |
public void mouseReleased(MouseEvent e) |