Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2065 > unrolled thread
| Started by | "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:36 +0000 |
| Last post | 2011-04-27 15:36 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.java.gui
ListSelectionListener Res "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: ListSelectionListener "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: ListSelectionListener "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
Re: ListSelectionListener "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
Re: ListSelectionListener "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
Re: ListSelectionListener "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
| From | "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | ListSelectionListener Res |
| Message-ID | <44-dnRhl6_OnVwbbnZ2dnUVZ_oimnZ2d@comcast.com> |
To: comp.lang.java.gui This seems quite different than the issue I had with an ActionListener responding twice (it was added twice). I've even checked to make sure this list box has only one ListSelectionListener. I have a JList that allows multiple interval selection and the ListSelectionListener is called when I press the mouse button down and when I release it. Somewhere along the way, I also get a third event. I added a line to the start of the valueChanged() method and it prints once when I press down on the left mouse button and twice more when I let the button up. I can't find anything in the ListSelectionEvent that lets me check to see if the event is from a mouse button down or up or a mouse click and I haven't found a reference to this happening. I haven't had this problem before, so I could see how it's related to allowing multiple intervals, but I'm still not clear on what is going on. Why am I getting multiple ListSelectionEvents and what do I do if all I want is one so I can then get the selected indices from the list? Thanks! Hal --- * 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 | "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: ListSelectionListener |
| Message-ID | <w5Qmi.29$nl4.7@newsfe06.lga> |
| In reply to | #2065 |
To: comp.lang.java.gui Hal Vaughan wrote: > Why am I getting multiple ListSelectionEvents and what do I do if all I > want > is one so I can then get the selected indices from the list? > I may be way off base, if so please disregard. ..or throw me out !-) <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4323107> --- * 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 | "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:37 +0000 |
| Subject | Re: ListSelectionListener |
| Message-ID | <nridndFhse0fSwbbnZ2dnUVZ_vLinZ2d@comcast.com> |
| In reply to | #2066 |
To: comp.lang.java.gui Jeff Higgins wrote: > > Hal Vaughan wrote: >> Why am I getting multiple ListSelectionEvents and what do I do if all I >> want >> is one so I can then get the selected indices from the list? >> > > I may be way off base, if so please disregard. ..or throw me out !-) > <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4323107> That seems to apply. I can follow most of that, but they discuss using DefaultListSelectionModel to see if the value is adjusting or not. I can't see how to get DefaultListSelectionModel from my JList. Am I missing something obvious? How can I check to see if it is adjusting or not? Hal --- * 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 | "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:37 +0000 |
| Subject | Re: ListSelectionListener |
| Message-ID | <Z8OdnWu5Rf19SgbbnZ2dnUVZ_hOdnZ2d@comcast.com> |
| In reply to | #2068 |
To: comp.lang.java.gui Hal Vaughan wrote: > Jeff Higgins wrote: > >> >> Hal Vaughan wrote: >>> Why am I getting multiple ListSelectionEvents and what do I do if all I >>> want >>> is one so I can then get the selected indices from the list? >>> >> >> I may be way off base, if so please disregard. ..or throw me out !-) >> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4323107> > > That seems to apply. I can follow most of that, but they discuss using > DefaultListSelectionModel to see if the value is adjusting or not. I > can't > see how to get DefaultListSelectionModel from my JList. Am I missing > something obvious? > > How can I check to see if it is adjusting or not? > > Hal Okay, got it. For some reason the ListSelectionEvent.getValueIsAdjusting() method wasn't coming up in my prompt in Eclipse. It's all working okay now. Hal --- * 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 | "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:37 +0000 |
| Subject | Re: ListSelectionListener |
| Message-ID | <aTQmi.30$nl4.19@newsfe06.lga> |
| In reply to | #2068 |
To: comp.lang.java.gui "Hal Vaughan" <hal@thresholddigital.com> wrote in message news:nridndFhse0fSwbbnZ2dnUVZ_vLinZ2d@comcast.com... > Jeff Higgins wrote: > >> >> Hal Vaughan wrote: >>> Why am I getting multiple ListSelectionEvents and what do I do if all I >>> want >>> is one so I can then get the selected indices from the list? >>> >> >> I may be way off base, if so please disregard. ..or throw me out !-) >> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4323107> > > That seems to apply. I can follow most of that, but they discuss using > DefaultListSelectionModel to see if the value is adjusting or not. I > can't > see how to get DefaultListSelectionModel from my JList. Am I missing > something obvious? > > How can I check to see if it is adjusting or not? > You can use .getSelectionModel on the JList, but I think they are saying to check the value of ListSelectionEvent.getValueIsAdjusting in your valueChanged(ListSelectionEvent e) method. Not absolutely certain on this one. JH --- * 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 | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: ListSelectionListener |
| Message-ID | <uskn9353vfjpp229i8c8t3hlsueu9nnq4l@4ax.com> |
| In reply to | #2065 |
To: comp.lang.java.gui
On Mon, 16 Jul 2007 15:42:50 -0400, Hal Vaughan
<hal@thresholddigital.com> wrote, quoted or indirectly quoted someone
who said :
>I can't find anything in the ListSelectionEvent that lets me check to see if
>the event is from a mouse button down or up or a mouse click and I haven't
>found a reference to this happening. I haven't had this problem before, so
>I could see how it's related to allowing multiple intervals, but I'm still
>not clear on what is going on.
try dumping
ListSelectionEvent.getValueIsAdjusting()
Returns whether or not this is one in a series of multiple
events, where changes are still being made.
see if that helps you figure out what is going on.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
---
* 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