Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pressing Enter In JTable

 
John Smith
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How can I prevent a JTable from jumping to the next row when enter is pressed? Thanks...
Randy
 
John Smith
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic