Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4380
| From | "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Sharing ListSelection |
| Message-ID | <48f8a154$1@news.uni-rostock.de> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <0bmdnV7u3oxyCWXVnZ2dnUVZ_r6dnZ2d@comcast.com> |
| Date | 2011-04-27 15:50 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui >... > Stefan Rybacki wrote: >> Well I don't have any action listener attached. And I can't change the >> code that notifies the listener. > > If you haven't got any listeners attached, how is there "code that > notifies the listener"? > The listeners are coming from the GUI element itself. A JList automatically attaches a ListDataListener to the model and a ListSelectionListener to the selection model. The same applies to the JTable. So basically what I do is provide a model that is wrapped once in a TableModel and also wrapped in a ListModel. Those models are then attached to either JList and JTable. While being 2 different model object they wrap the same model in the background. Additionally I create a DefaultListSelectionModel add attach them to the table and the list So again, what happens is. When I e.g. add an item to the main model. Both the table and the list are notified since they attached ListDataListeners/TableModelListener to the model. Additionally they internally notify the selection model because there was an item added and therefore some selections might need to be moved one up. But since both table and list do this selections are moved up twice. Stefan --- * 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 | Next — Previous in thread | Next in thread | Find similar
Sharing ListSelectionMode "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
Re: Sharing ListSelection "Stefan Rybacki" <stefan.rybacki@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
csiph-web