Swing- focus problem
Posted
by AlonaK
on Stack Overflow
See other posts from Stack Overflow
or by AlonaK
Published on 2010-04-04T08:43:16Z
Indexed on
2010/04/04
8:53 UTC
Read the original article
Hit count: 275
Hi,
In my application I have a frame, with toolbar (the toolbar contains some actions). I want the toolbar to be visible only when the window is focused. So, I registered a windowFocusListener on the window. The problem is- when the window is not focused and I click on the place where a tool bar action should be- the action is performed. This happens because the WindowFocusGained is called before the mouse button is released and when the mouse button released it calls the actionPerformed.
Does anybody has any idea for a work around for this problem? Does anybody know how to determine wether the mouse button is clicked now?
© Stack Overflow or respective owner