cathalmchale
asked on
Remove a once-off listener
I have the following:
private boolean firstTime = true;
// only for initial visuals and selections
this.addComponentListener( new ComponentListener()
{
public void componentResized(Component Event e)
{
}
public void componentMoved(ComponentEv ent e)
{
}
public void componentHidden(ComponentE vent e)
{
}
public void componentShown(ComponentEv ent e)
{
if (firstTime)
{
//tree.clearSelection();
firstTime = false;
}
}
});
once the action has been performed once i want to remove the action - but of course i cant do this.removeActionLi... from inside the listener itself!!
Regards,
Cathal.
private boolean firstTime = true;
// only for initial visuals and selections
this.addComponentListener(
{
public void componentResized(Component
{
}
public void componentMoved(ComponentEv
{
}
public void componentHidden(ComponentE
{
}
public void componentShown(ComponentEv
{
if (firstTime)
{
//tree.clearSelection();
firstTime = false;
}
}
});
once the action has been performed once i want to remove the action - but of course i cant do this.removeActionLi... from inside the listener itself!!
Regards,
Cathal.
in the above replace
Component c = e.getSource();
by
Component c = e.getComponent();
Component c = e.getSource();
by
Component c = e.getComponent();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that easy ;-)
;°) Life can be easy
// Do whatever needed
Component c = e.getSource();
c.removeComponentListener(
}