• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java JTable keybindings working differently for tab and enter keys

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following requirement:
1. When tab/enter key is pressed in JTable, read the value in selected cell and go to the next cell
2. This should happen whether the cell is in select mode or edit mode

The program written is not working when a cell with existing value is edited by pressing F2 key and enter key is pressed. For all other scenarios it is working fine.
To recreate the issue, please follow the below steps:
        Enter "a" in cell(0,0) --> press enter key --> use left arrow to go to cell(0,0) --> press F2 key --> Enter "b" in cell(0,0) --> Press enter key --> Here action performed is not called.

Please review the below program and let me know what changes to be done to meet the requirement.

TableTest.java:

 
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this is the ideal solution or what side effects may occur but you could reassign the F2 key to the same action as Enter ie add the following:

 
Tony Docherty
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And Welcome to the Ranch
 
Jaga Subbu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the warm welcome...
I ll try it and let you if it works.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic