Listeners Firing Too Often



I am developing a GUI (in Java, of course) that has a JTree on the
left hand side of the window (similar to Windows Explorer or something
like that) and on the right hand side the user can open various
property windows to edit the items in the JTree.

The issue I'm having is this...

I have added a key listener to one of the property windows so that,
when the user hits the delete key, they can delete parts of the
equation they constructed (mathematical equations). The JTree also
has a separate key listener that will delete the selected nodes in the
tree if I hit the delete key. Both these keylisteners work fine on
their own.

However, when I open up the property window and highlight part of the
equation and hit the delete key, not only does that part of the
equation delete, but then the JTree also captures the KeyAction and
deletes the currently selected node in the JTree.

I have no clue why this is happening. The JTree doesn't have direct
focus. I haven't been able to find any real connection between the
two components.

Any ideas/suggestions/?

.



Relevant Pages

  • Re: Listeners Firing Too Often
    ... property windows to edit the items in the JTree. ... I have added a key listener to one of the property windows so that, ... I updated the GUI so that when the user hits the Delete key, ...
    (comp.lang.java.gui)
  • Editable JTree & KeyEvent
    ... wrote the pop-up menu). ... when I hit to ... KeyListener I have on the tree is fired as well: ... Where "this" is the JTree. ...
    (comp.lang.java.gui)