• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set FoucsTraversalPolicy in GridLayout  RSS feed

 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have created a screen, but in this screen I have 11 text fields. Now because I have used GridLayout so by default focus is going to the next added component in the screen. But I want to change this behavior so that focus should traverse from top to bottom first and then left to right.

Any idea to implement this kind of functionality.

Here is my code.

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works OK in the sample program, but in a larger app with possibly a number of focus cycles, it would need more code

 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:this works OK in the sample program, but in a larger app with possibly a number of focus cycles, it would need more code



Thanks for this solution, so what do you think we should adopt for larger applications?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> what do you think we should adopt for larger applications?

depends entirely on what you want the focusTraversal to do
e.g. when at the end of the 11th textfield should it go back to the first,
perhaps it should go to the next focus cycle.
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> what do you think we should adopt for larger applications?

depends entirely on what you want the focusTraversal to do
e.g. when at the end of the 11th textfield should it go back to the first,
perhaps it should go to the next focus cycle.


That makes sense to me!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!