Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1087 > unrolled thread
| Started by | "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:31 +0000 |
| Last post | 2011-04-27 15:31 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.gui
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
| From | "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:31 +0000 |
| Subject | Listeners Firing In the W |
| Message-ID | <1172859692.554224.105910@t69g2000cwt.googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:31 +0000 |
| Subject | Re: Listeners Firing In t |
| Message-ID | <esa8sf$kvv$1@registered.motzarella.org> |
| In reply to | #1087 |
To: comp.lang.java.gui Jason Cavett wrote: > As far as I know, listeners fire in the order that they're added to an > object. No. Apart from that you're talking about different types of listeners. > When I set the tree's cell editor, the constructor of my > cell editor sets itself as its own listener. Why? > > 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. Without knowing the details: wrong way. Let the TreeModel update it's items. Bye Michael --- * 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]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:31 +0000 |
| Subject | Re: Listeners Firing In t |
| Message-ID | <1172888896.494213.269930@64g2000cwx.googlegroups.com> |
| In reply to | #1087 |
To: comp.lang.java.gui On Mar 2, 10:21 am, "Jason Cavett" <jason.cav...@gmail.com> wrote: > As far as I know, listeners fire in the order that they're added to an > object. *bzzt* wrong. There isn't any guaranty about the order events are processed, other than they are generally processed in the event dispatch thread (assuming you're using Swing). --- * 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