• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NextFocusableComponent -> FocusTraversalPolicy

 
Carlos Delgado
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all again!
I'm using a Swing application and I noticed that "NextFocusableComponent" is being deprecated and replaced by the "FocusTraversalPolicy".
Does anyone here know how does it work?? All I want is set an order for my controls when the TAB key is pressed.
Thanks!!
 
Michael Dunn
Ranch Hand
Posts: 4632
 
Carlos Delgado
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply!
But in the Sun Java help pages there are not examples of it... :'( I was trying to avoid those eternal readings without examples.
All I want is a little sample for changing focus between 3 JTextFields! Any ideas?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's something to play around with - it just reverses the 'normal' tab
order i.e. bottom to top, but you can make it anything you want, in keyPressed()

Don't know if this is a 'reasonable' way to do it, or if there's any pitfalls doing it this way, so lots of testing required.

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems the correct is something like this

 
Carlos Delgado
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Michael! I got it working now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic