Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes Pressing Enter In JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Pressing Enter In JTable" Watch "Pressing Enter In JTable" New topic
Author

Pressing Enter In JTable

John Smith
Ranch Hand

Joined: Jul 20, 2001
Posts: 84
Hello,
How can I prevent a JTable from jumping to the next row when enter is pressed? Thanks...
Randy
John Smith
Ranch Hand

Joined: Jul 20, 2001
Posts: 84
I should have done a more thorough search before I posted. This has already been answered in another post by Cindy Glass. Simply attach a key listener to the JTable, look for the enter key being pressed, and consume it. Example:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pressing Enter In JTable