Results 1 to 1 of 1
- 12-20-2010, 08:39 AM #1Member
- Join Date
- Nov 2010
- Rep Power
Writing a custom ListSelectionListener
I intend to write a custom ListSelectionListener (or at least, that is what I think will solve my problem) that only allows zero to two selected values (not intervals). Obviously I googled what I'm writing as my title (so I'm writing this title to help people looking for this later on) beforehand - and it gave me only one relevant result from stackoverflow - but the problem was unsolved.
When 2 values are already selected, deselect the value that was last selected (all I need here, I think, are two int variables (one for the first selected value, one for the last selected value, where -1 is nothing selected) that I change everytime a selection change is fired).
- And in case of dragging the mouse around to select a value, don't deselect when hitting a selected value, until valueIsAdjusting() returns false.
Well, I have no idea where to start so if anyone out there just have a pinpoint to what I should do (write a class that extends ListSelectionListener, or whatever) and maybe a single line of description of why that's the optimal way of doing it - since I have no experience other than using the default three options.
And just to give you an idea of what I might understand: I started learning Java from August this year - and it's my first programming language.
Whenever someone is delightful enough to give me some directions I'll write an SSCCE so it will become easier to help me further.
Thanks in advance!
- By vinsun in forum Advanced JavaReplies: 1Last Post: 07-02-2010, 11:24 AM
- By Broden_McDonald in forum New To JavaReplies: 1Last Post: 02-27-2010, 02:29 AM
- By wadhah.alhaddad in forum New To JavaReplies: 1Last Post: 02-07-2010, 04:54 PM
- By xcallmejudasx in forum New To JavaReplies: 2Last Post: 02-12-2009, 06:22 AM
- By ravian in forum New To JavaReplies: 2Last Post: 12-29-2007, 06:05 PM