• 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

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic