Results 1 to 3 of 3
- 01-16-2011, 12:13 AM #1
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
listener for a jtable triggers twice
hi, I am using a jtable to get the records displayed from my jdbc table. what I would like to do is after clicking a certain row, it will display another window showing more information about the clicked record but my problem is the action triggers twice
this one show the index of the selected row but it prints out the 'sel' variable twice.. I was wondering if I can just use another listener like a mousepressed event for the table if it is possible or is there still a fix for the code above so it will just trigger once?Java Code:jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int sel = jTable.getSelectedRow(); System.out.println("row clicked: " + sel); } });
- 01-16-2011, 12:16 AM #2
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
update:
when I use my arrow keys it triggers only once
also when I just press the left mouse button (not releasing it) it will trigger once, and when I release the mouse button it will trigger again and I don't believe I have an action listener for the mousclicked or mousreleased event
- 01-16-2011, 01:08 AM #3
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Similar Threads
-
Urgent:Jtable and key Listener
By simmi in forum AWT / SwingReplies: 3Last Post: 02-02-2010, 05:56 AM -
JTable Cell Focus Listener
By Manfizy in forum New To JavaReplies: 1Last Post: 07-21-2009, 08:08 AM -
Make specific cell a hyperlink (triggers event)
By javanewbie in forum AWT / SwingReplies: 3Last Post: 06-21-2009, 03:26 AM -
add an undo listener to a Jtable
By christina in forum Advanced JavaReplies: 12Last Post: 01-29-2009, 07:47 AM -
Jtable duplicates through Hashtable (JTable condition problem) my assignment plz help
By salmanpirzada1 in forum Advanced JavaReplies: 2Last Post: 05-15-2008, 10:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks