• 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:

How to change the tab order for jumping from one textfield to another

 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I have a problem. Within my JPanel I have several textfields and one button.
Because the button is located right of my first textfield, when I use the tab key the focus is jumping from the first textfield to the button. But I want the focus to jump from the first to the second textfield. Because I don't want to change the visual order of my components, do you have any idea?
Regards,
ulrich
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FocusTraversalPolicy:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/FocusTraversalPolicy.html

Example:
http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use a custom FocusTraversalPolicy

http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter and Michael, you guys have karma - the same link at the same time - cool
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it was the full moon!
 
Ulrich Heeger
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter, Michael, Ulf,
sorry, that I haven't answered earlier. I haven't been in the office since friday. Thanks a lot for your help,
regards,
Ulrich
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic