我在 AbstractTableModel 上创建了一个表。在这张表中,我有一行。我需要添加 ActionListener 和来自“数据库 ID”列的参数 - 即。图像。当您双击该行时,应该调用此 ActionListener。 Image
所以我的问题是如何从表 ActionListener 中获取参数到 JDialog。
感谢您的帮助。
最佳答案
- 使用
MouseListener
检测用户何时单击表格,How to Write a Mouse Listener了解更多详情 - 使用
JTable#columnAtPoint(Point)
和JTable#rowAtPoint(Point)
获取用户点击点的行值和列值 - 使用
JTable#getValueAt
获取给定行/列位置的单元格的值
关于java - JTable Actionlistener 单击带有参数的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27200346/