I have a bug in my application that i'm not able to find.
I have some selectable and resizable JPanel , which display a border when selected. For some of them the border dissapear after moving them, without apparently any reason. Since now i have found no bug in my app, (no other component that the selected one is requesting or gaining focus) but i noticed that when my selected component loses the focus, the JToolbar gain it.
So my question is, in which situations (maybe involving MouseEvents), does the JToolbar component request to have focus ?
Alternatively, is there anyway to disable JToolbar for requesting focus or to know which component is the current focus owner?
I finally solved my problem. I noticed than setting a focused component to invisible, automatically release the focus. JToolbar wasn't directly involved in this process, but was the component directly upside in the components hierarchy so it gained the lost focus. So if I have to set a component invisible and then visible again, it must acquire again the focus explicitly.