Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1463
| From | "clearlight" <clearlight@THRWHITE.remove-dii-this> |
|---|---|
| Subject | How to detect focus lost |
| Message-ID | <1176780250.432084.322580@o5g2000hsb.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:33 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui Hi, I am new to Java. As a basic learning project, I started writing a no- frill small general ledger application. The basic design is a Frame containing a menu and a JTabbedPanel. When a menu option is selected, a component derived from JPanel containing the graphical interface for the data entry of the selected option is created, added to the JTabbedPane component and the corresponding Tab is selected. 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. So far, I have tried to add a FocusListener to the JPanel descendents, but it doesn't work as I expected: JPanel fires a focusLost event when focus enters a JTextField contained within the panel itself, and fires nothing when a menu option is selected. If I establish a dependency between the main JFrame and the contained JPanel derivates, I might perhaps design a sort of bidirectional notification protocol, but I would like to avoid any dependence that can be avoided. So, is there a standard event that lets me know when the focus leaves a JPanel (FocusListener doesn't work, because -at least in my configuration: NetBeans 5.5, JDK 1.6, WinXP- it fires when a control within the panel gains focus)? TIA --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar | Unroll thread
How to detect focus lost "clearlight" <clearlight@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: How to detect focus l "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: How to detect focus l "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: How to detect focus l "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
csiph-web