This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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:
 
GeeCON Prague 2014
 
subject: Pressing Enter In JTable