Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

focuslistener on jpopupmenu

2 views
Skip to first unread message

Vijay L

unread,
Oct 6, 2003, 2:40:08 AM10/6/03
to
An applet I'm developing has a JTree on top of it. When right-clicked
a JPopupMenu pops up. There are no problems regararding the behaviour
of the jpopupmenu or jtree. When the jpopupmenu is visible and the
browser window is minimized and restored the jpopupmenu is still
visible.

I've tried using focuslistener but adding the focuslistener to the
jtree works fine but does not listen to the jpopupmenu.

Is there any other way I can solve my problem?

Thanks in advance.

---
Cheers,
Vijay

M Series

unread,
Oct 6, 2003, 4:13:11 PM10/6/03
to

Try an ancestorListener


Vijay L

unread,
Oct 10, 2003, 9:18:17 AM10/10/03
to
"M Series" <spa...@127.0.0.1> wrote in message news:<blsibb$hgl$1...@newsg4.svr.pol.co.uk>...

Sorry for the delayed response.

Thanks MSeries but the AncestorListener doesn't work either. Here's
part of the code I've used:

jpmenu.addAncestorListener(new AncestorListener() {
public void ancestorAdded(AncestorEvent e)
{
System.out.println("ancestor added");
}
public void ancestorMoved(AncestorEvent e)
{
System.out.println("ancestor moved");
}
public void ancestorRemoved(AncestorEvent e)
{
System.out.println("ancestor moved");
}
});

Minimizing the browser window, resizing, moving it don't call these
methods even when the jpopupmenu is visible.

The right-click event is defined such that the jpopupmenu becomes
visible. The mouseListener for this is added to the JTree.

Or should I use the AncestorListener some other way? I feel uneasy
because I haven't, in any way, specified that the JTree is the
ancestor. I'd be able to find out the /real/ ancestors if the methods
were invoked but that isn't happening.

Any help appreciated.

Cheers,
Vijay

0 new messages