Article View: borland.public.jbuilder.java.swing
Article #48Re: Problem with focusLost event... PLEASE HELP !!
From: Johan Forsberg
Date: Thu, 18 Nov 1999 00:00
Date: Thu, 18 Nov 1999 00:00
29 lines
1627 bytes
1627 bytes
Nadia AKROUR <nakrour@spring.fr> skrev i
diskussionsgruppsmeddelandet:3832DC26.93786C08@spring.fr...
> ...
> public void onShowWindow(ActionEvent e) {
> MyWindow mywin = new MyWindow();
> mywin.show();
> mywin.requestFocus();
^^^^^^^^^^^^^^^^^^^^^^
Remove this row.
> addFocusListener(new FocusAdapter() {
> public void focusGained(FocusEvent e) {
> mytab.requestFocus();
> System.out.println("window focusGained");
> }
> public void focusLost(FocusEvent e) {
> System.out.println("window focusLost");
> }
This focus listener seems unessecary...
> But the window pops up and closes itself immediatly.
I think what is happening i that when you show the window, the first
component
in it (the table) gets the focus. You then move the focus to the window
itself
(why?), causing the table to loose focus and kill the window.
Technical Details
Message-ID:
<810foe$rl09@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3832DC26.93786C08@spring.fr>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a0662ecd0a1aac05 X-Google-Attributes: gid111d45,public X-Google-Thread: f74b3,a0662ecd0a1aac05 X-Google-Attributes: gidf74b3,public From: "Johan Forsberg" <jfo@SPAM_SPAM_EGGS_SPAMstmf.se> Subject: Re: Problem with focusLost event... PLEASE HELP !! Date: 1999/11/18 Message-ID: <810foe$rl09@forums.borland.com> X-Deja-AN: 550054327 References: <3832DC26.93786C08@spring.fr> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing,borland.public.jbuilder.java.language