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


Groups > comp.lang.java.gui > #1087

Listeners Firing In the W

From "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Subject Listeners Firing In the W
Message-ID <1172859692.554224.105910@t69g2000cwt.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:31 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
As far as I know, listeners fire in the order that they're added to an
object.

With that in mind, I am creating a JTree (extend JTree).  Here is my
setup process...

1. I first set the tree's model (class/es that implement
MutableTreeNode).

2. Set the tree's cell editor.  The cell editor extends
DefaultTreeCellEditor and implements the CellEditorListener
interface.  When I set the tree's cell editor, the constructor of my
cell editor sets itself as its own listener.

3. I then have the tree's model items add themselves as
TreeModelListeners of the tree (they implement the TreeModelListener
interface).  This way they can react to changes made directly to the
tree.


So, if I rename a node on the tree, I want the CellEditorListener to
fire first (to update the model item that was changed) and I want the
TreeModelListener to fire second.  However, the reverse is happening.
I'm very confused why this is.  Can anybody explain how listeners fire
or why these listeners are not firing in the (seemingly appropriate
order).

Sorry I don't have any code to paste.  Thanks for any help.

---
 * 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

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

Listeners Firing In the W "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Listeners Firing In t "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Listeners Firing In t "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000

csiph-web