Results 1 to 1 of 1
- 12-20-2010, 08:39 AM #1
Member
- Join Date
- Nov 2010
- Posts
- 73
- Rep Power
- 0
Writing a custom ListSelectionListener
Hey all.
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!
Similar Threads
-
writing Custom exception and its implementation
By vinsun in forum Advanced JavaReplies: 1Last Post: 07-02-2010, 11:24 AM -
Im writing to a file and i want to skip lines while writing to a text file.
By Broden_McDonald in forum New To JavaReplies: 1Last Post: 02-27-2010, 02:29 AM -
Custom GUI...Help?!
By wadhah.alhaddad in forum New To JavaReplies: 1Last Post: 02-07-2010, 04:54 PM -
[SOLVED] Writing an Iterator method in a custom list
By xcallmejudasx in forum New To JavaReplies: 2Last Post: 02-12-2009, 06:22 AM -
Custom tgs in JSP
By ravian in forum New To JavaReplies: 2Last Post: 12-29-2007, 06:05 PM
Bookmarks