πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JWindow windowDeactivated doesn't seem to work !!

#10160
From: Nadia AKROUR
Date: Wed, 03 Nov 1999 00:00
45 lines
2200 bytes
Khurram Shakir a οΏ½crit :
> 
> Nadia,
> instead of using windows deactivated event use contentPane of the window and
> trap mouse event using addmouse Listener.
> and use
> setVisible(false) on mouse click
> first getTopLevelAncester of your contentPane Panel and the
> JWindow win = new JWindow();
> JPanel panel; // your panel;
> win.setContentPane(panel);
> JWindow w = (JWindow)panel.getTopLevelAncestor();
> w.setVisible(false);
> 
> use setVisible(false) and then call dispose();
> 
> hope this will help;
> regards,
> Khurram

Sorry but I will try to explain better...

I have a JButton in a JPanel. A clic on that button popup a JWindow. The
window contains a JTable in a JScrollPane. The JWindow derived class
implements a WindowListener to intercept the deactivatedWindow event.

I want the window to close when : 

1- the user double-clicks on a row in the table (works well)

2- the user clicks out of the window. At first I thought
deactivatedWindow was called but nothing... (perhaps it's a bug ??). So
instead I decided to try implementing a FocusListener on the JTable and
call dispose() on the focusLost() method call. The closing works fine
but I have to clic on the window to make it active first and it gaines
the focus. But how can I force the focus to be on the window when it
popup ?? I call requestFocus on the JTable just after calling show() but
in that case the window popup and close itself.

I don't know if I make it clear but any help would be very appreciated
because I don't know what to do  now...
Thanks in advance
-- 

	Nadia.
Technical Details
Message-ID: <38207C0D.8C56A185@spring.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37F1F05A.39A59771@spring.fr> <7ufcqp$p6d13@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,48eb60fc7fd3ad91
X-Google-Attributes: gid111d45,public
From: Nadia AKROUR <nakrour@spring.fr>
Subject: Re: JWindow windowDeactivated doesn't seem to work !!
Date: 1999/11/03
Message-ID: <38207C0D.8C56A185@spring.fr>
X-Deja-AN: 544021219
Content-Transfer-Encoding: 8bit
References: <37F1F05A.39A59771@spring.fr> <7ufcqp$p6d13@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