不要自卑,去提升实力
互联网行业谁技术牛谁是爹
如果文章可以带给你能量,那是最好的事!请相信自己
加油o~
文章目录
一、Jtable的点击监听
1.table.getSelectedRow()可以获取选中行的下标
2.table.getValueAt(count,0).toString()获取指定行的某列元素,因为返回的是Object类型,所以需要将它转换为String类型使用
3.table.setSelectionModel().clearSeection()取消选中行
二、代码
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
int count=table.getSelectedRow();
String name2=table.getValueAt(count, 0).toString();
new menzhekuxiangxixinxi(name2);
table.getSelectionModel().clearSelection();
}
});