Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Enable custom FocusTraversalPolicy in Swing (See related posts)

Every container in Swing/AWT can be given a FocusTraversalPolicy with:
   1  public void setFocusTraversalPolicy(FocusTraversalPolicy policy)

Remember to enable the container as a FocusCycleRoot:
   1  setFocusCycleRoot(true)

Together it looks like:
   1  
   2  container.setFocusTraversalPolicy(myCustomPolicy);
   3  container.setFocusCycleRoot(true);

You need to create an account or log in to post comments to this site.


Click here to browse all 5273 code snippets

Related Posts