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
Try an ancestorListener
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