Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable single click edit, vs double click action problem

843805Nov 16 2006 — edited Nov 17 2006
Hi everyone,

I have a small problem which hopefully has a solution! I have a JTable which represents a bunch of objects, that when double clicked opens an editor which permits us to view the information related to the objects.

One of the JTable's columns has in each row, the subject/title of the object it represents.

I have a MouseAdapter on the table which currently successfully captures the double-click to open event. I'd like to add a second event, that permits the cell editor to fire, if the user single clicks the row when it was already selected.

Problem:
else if( e.getClickCount() == 1 && table.isRowSelected( row ) ){
				System.out.println( e.getClickCount() );
				
				int column = table.columnAtPoint( e.getPoint() );
				table.editCellAt( row, column );
				table.setEditingRow( row );
				table.setEditingColumn( column );
				table.repaint();
			}
This code seems to intercept the doubleclick event! It would appear that the doubleclick selects the row after the first click, and not after the second.

How then can I achieve the functionality desired?

Regards.
Alex
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2006
Added on Nov 16 2006
7 comments
2,488 views