您可以在这里快速查找:


 
您的位置: 编程学习 > java教程 > 200601
文章分类

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02

Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

VB编程
2006: 02

Asp编程
2005: 11 12
2006: 01 02

C++/VC
2005: 10 11 12
2006: 01 02

Delphi
2005: 12
2006: 01 02

其它

 本文章适合所有读者

JTable中怎样获取鼠标所在位置的行数

yangbc

table=new JTable(cells,columnNames);

table.addMouseListener(new java.awt.event.MouseAdapter()
             {
                 public void mouseClicked(java.awt.event.MouseEvent e)
                 {
                     System.out.println("mouseClicked()"); // TODO Auto-generated
                                                           // Event stub
                                                           // mouseClicked()
                    
                     System.out.println("row numbers is :"+table.getRowCount());//获取表格的总行数
                    
                     //获取鼠标点击的行的位置(及行数)
                     Point mousepoint;                    
                     mousepoint =e.getPoint();
                     System.out.println(table.rowAtPoint(mousepoint)+1);
                    
                 }
             });