Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1008 > unrolled thread

Listeners Firing Too Ofte

Started by"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
First post2011-04-27 15:30 +0000
Last post2011-04-27 15:30 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Listeners Firing Too Ofte "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
    Re: Listeners Firing Too "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
    Re: Listeners Firing Too "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000

#1008 — Listeners Firing Too Ofte

From"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectListeners Firing Too Ofte
Message-ID<1172178471.140471.20160@s48g2000cws.googlegroups.com>
  To: comp.lang.java.gui
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/?

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#1009 — Re: Listeners Firing Too

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectRe: Listeners Firing Too
Message-ID<1172180771.804535.154330@l53g2000cwa.googlegroups.com>
In reply to#1008
  To: comp.lang.java.gui
On Feb 23, 8:07 am, "Jason Cavett" <jason.cav...@gmail.com> wrote:
> I am developing a GUI (in Java, of course)
...
> Any ideas/suggestions/?

Supply an SSCCE.

Andrew T.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1014 — Re: Listeners Firing Too

From"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectRe: Listeners Firing Too
Message-ID<1172246285.492663.48200@q2g2000cwa.googlegroups.com>
In reply to#1008
  To: comp.lang.java.gui
On Feb 22, 4:07 pm, "Jason Cavett" <jason.cav...@gmail.com> wrote:
> 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/?

Solution:

Both listeners worked fine on their own.  The issue was that the main
menu bar used the VK_DELETE accelerator for it's Delete menu option.
So, when the user pressed "Delete" on the keyboard, the menu bar fired
"deletes" to ALL components in the GUI.

I updated the GUI so that when the user hits the Delete key, delete is
only fired on the component that currently has focus.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web