πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10094

Re: Problem with focusLost event... PLEASE HELP !!

#10094
From: Nadia AKROUR
Date: Thu, 18 Nov 1999 00:00
39 lines
1938 bytes
Johan Forsberg a οΏ½crit :
> 
> 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.

Thank you for your help but the problem is that if I remove the focus
listener and the requestFocus()  the window shows up but the table seems
not to have the focus. I have to clic in it and a clic outside the
window makes it close. So how can I make the table have the focus when
the window shows up ?
-- 

	Nadia.
Technical Details
Message-ID: <3833E0BF.40998F30@spring.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3832DC26.93786C08@spring.fr> <810foe$rl09@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,a0662ecd0a1aac05
X-Google-Attributes: gid111d45,public
From: Nadia AKROUR <nakrour@spring.fr>
Subject: Re: Problem with focusLost event... PLEASE HELP !!
Date: 1999/11/18
Message-ID: <3833E0BF.40998F30@spring.fr>
X-Deja-AN: 550065735
Content-Transfer-Encoding: 8bit
References: <3832DC26.93786C08@spring.fr> <810foe$rl09@forums.borland.com>
X-Accept-Language: fr-FR,en
Content-Type: text/plain; charset=iso-8859-1
Organization: SPRING TECHNOLOGIES
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing