[SOLVED] Focus on window decoration & JSplitPane buttons

Discuss here any questions about the WebLaF library.
Bugs can be posted directly to GitHub issues tracker.

[SOLVED] Focus on window decoration & JSplitPane buttons

Postby walazins » Fri Jul 18, 2014 6:25 pm

First, Thanks, I love the WebLAF. I had been going through several LAF's, never satisfied, until I found this one. Great Work!

To my question, I love the Window Decoration Feature, and I also use the Split Pane in a program I am writing. I have multiple text fields on certain portions of my program and before adding the Window Decoration and Split Pane I could cycle focus through my Textfield/Button components only, but now the 2 split pane and 3 window buttons also can receive focus, and I have been unable to figure out how to disable focus to those. Is their a way to do this?
walazins
 
Posts: 1
Joined: Tue Jul 15, 2014 7:51 pm

Re: Disabling Focus on Window Decoration & Split Pane Button

Postby mgarin » Fri Jul 18, 2014 7:38 pm

There are two base Swing features:

1. Disable focus on specific component:
Code: Select all
component.setFocusable ( false );

This will make any component (button, field, tree - whatever) unfocusable.
Focus switching will skip components with disabled focusable state.

2. Force any container to cycle focus (when switched by TAB) within itself:
Code: Select all
container.setFocusCycleRoot ( true );

This will force focus to always stay inside this container if you are trying to switch between components through TAB hotkey. Other components outside of this container might still be focused (mostly if clicked with mouse for example) or focus is transferred in the code.

Hope this answers your question.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: Disabling Focus on Window Decoration & Split Pane Button

Postby mgarin » Wed Aug 06, 2014 5:37 pm

In addition to what I said before - I have improved focusable state on split pane and window decoration so it acts more like other L&F decorations.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron