This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NextFocusableComponent -> FocusTraversalPolicy

 
Carlos Delgado
Greenhorn
Posts: 15
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A bit of 'light' reading

http://java.sun.com/j2se/1.4/docs/api/java/awt/doc-files/FocusSpec.html
 
Carlos Delgado
Greenhorn
Posts: 15
  • 0
  • 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
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems the correct is something like this

 
Carlos Delgado
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Michael! I got it working now!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic