-1
我试过使用table.getSelectedRows(),table.getSelectedColumns()但我也想获得拖动的方向,所以我想我需要找到最后细胞那个光标(表格的光标)在它上面得到了拖动的方向,但是仍然没有任何想法,我尝试去寻找这种风格的函数或者解决方案,但是仍然没有找到。有没有人有一个很好的解决方案呢?非常感谢你如何获取最后选中的单元格jtable
这个小区,我一点
我试过使用table.getSelectedRows(),table.getSelectedColumns()但我也想获得拖动的方向,所以我想我需要找到最后细胞那个光标(表格的光标)在它上面得到了拖动的方向,但是仍然没有任何想法,我尝试去寻找这种风格的函数或者解决方案,但是仍然没有找到。有没有人有一个很好的解决方案呢?非常感谢你如何获取最后选中的单元格jtable
这个小区,我一点
您需要使用的ListSelectionModel得到这个信息:
ListSelectionModel lsm = table.getSelectionModel();
int start = lsm.getAnchorSelectionIndex();
int end = lsm.getLeadSelectionIndex();
System.out.println(start + " : " + end);
TableColumnModel tcm = table.getColumnModel();
lsm = tcm.getSelectionModel();
start = lsm.getAnchorSelectionIndex();
end = lsm.getLeadSelectionIndex();
System.out.println(start + " : " + end);
*“也想拖动的方向“*为什么?请参阅[什么是XY问题?](http://meta.stackexchange.com/q/66377) –
感谢您的回复,我想从第一个单元格开始渐变,我开始拖动到完成我停止拖拽的最后一个单元格,这就是为什么我认为我需要获取最后一个单元格的位置。对不起,要求尝试解决方案 – pteerawat
也许尝试[这些方法]之一(http://stackoverflow.com/q/7620579/230513)。 – trashgod