Re: How to detect focus lost on a JPanel
- From: "Jeff Higgins" <oohiggins@xxxxxxxxx>
- Date: Wed, 18 Apr 2007 16:47:49 -0400
Jeff Higgins wrote>
Ian Wilson wrote:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4403182
clearlight@xxxxxxxxx wrote:
Inside any of this panels, there are JTextFields that have to be
validated (via InputVerifiers).
Now, if focus is inside any of this JTextFields, and I select a new
option from the frame's menu, validation shouldn't be fired.
I had a similar problem, an input panel with OK and Cancel buttons. If
the user is editing a JTextField then clicks Cancel, you don't want the
validation to kick in. I used this approach:
cancelButton.setVerifyInputWhenFocusTarget(false);
In your shoes I'd read the docs to see if
.setVerifyInputWhenFocusTarget(false) can be applied to your JMenuItems
Strange, that JMenu, JMenuBar don't seem to honor
.setVerifyInputWhenFocusTarget(false)
I could only get your suggestion to work using:
f.getRootPane().setVerifyInputWhenFocusTarget(false);
as below. I don't know what implications that may hold.
What about pop-up context menus?
.
- References:
- How to detect focus lost on a JPanel
- From: clearlight
- Re: How to detect focus lost on a JPanel
- From: Ian Wilson
- Re: How to detect focus lost on a JPanel
- From: Jeff Higgins
- How to detect focus lost on a JPanel
- Prev by Date: How to write an "user control"
- Next by Date: current jtable cell not returned
- Previous by thread: Re: How to detect focus lost on a JPanel
- Next by thread: menus
- Index(es):