• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

tabbing in JTable

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,
i have a JTable in one JInternal Frame and set of textfields in the second JInternal frame.when i hit a insert button ,a new row will be added to the JTable and after entering a value for that cell and if i hit tab key,the focus should go to the first text field in the second JInternal frame.
i have tried adding a Key Listener and if the event was from tab key do,
table.setNextFocusableComponent(jTextField1);
this is not setting the cursor to the textfield instead setting it to the next element in the table.
i have tried extending JTable and overridding the isFocusTraversable() method,with returning false, but this time it takes the focus from the table itself.
i don't want this to happen,what i want want is that the should be intial focus on the JTable and if the selected row and column is the last and hitting the tab key, the focus should go the second JInternal frame.

is it possible,if so how,
thanks in advance,
lavanya
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you only want to change the normal
focus traversal when the user hits tab after they
insert.
How about watching for that tab as you did, but
actually setting the focus exactly where you want
it at that point, instead of calling
table.setNextFocusableComponent()?
HTH,
Joe

Originally posted by lavanya subramanian:

i have tried adding a Key Listener and if the event was from tab key do,
table.setNextFocusableComponent(jTextField1);
this is not setting the cursor to the textfield instead setting it to the next element in the table.

 
lavanya subramanian
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Joe,
thanks for the reply,
actually the fixed the problem ,
i did jTextField1.requestFocus() when tab key is hit and it's working.
thanks a lot,
lavanya
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic