Results 1 to 1 of 1
- 01-24-2011, 05:10 PM #1Member
- Join Date
- Oct 2010
- Rep Power
Writing a Class to Implement ListSelectionModel Directly?
I would like to implement my own ListSelectionModel without extending it from DefaultListSelectionModel, because I need some special list that behaves in a special way. How can I actually set the selection state of individual cells from setSelectionInterval , without using JList.setSelectionInterval (which itself calls ListSelectionModel.setSelectionInterval)? I can implement ListSelectionModel.isSelectedIndex correctly, but the problem I have is that it won't get called systematically...
What I need my list to do more specifically is to be able to change the selection state of any cell in the list if ListSelectionMode.setSelectionInterval gets called with a given range of indices. The only solution I have found so far is to extends DefaultListSelectionModel and then call:
in my overriden implementation of setSelectionInterval, after doing the necessary changes to my interval list such that my overriden implementation of isSelectedItnerval returns the right values. However, this solution is extremely inefficient and I want to avoid it if possible. As I said, I want to write my own class to implement ListSelectionModel instead of extending DefaultSelectionModel.
Last edited by kreyszig; 01-24-2011 at 05:26 PM.
- By noobForever in forum New To JavaReplies: 8Last Post: 12-04-2010, 04:58 PM
- By smray7 in forum New To JavaReplies: 3Last Post: 11-30-2010, 07:16 PM
- By ALH813 in forum EclipseReplies: 1Last Post: 10-02-2009, 01:35 AM
- By doanhanam in forum New To JavaReplies: 1Last Post: 11-16-2008, 08:24 PM
- By Britt7 in forum New To JavaReplies: 3Last Post: 10-27-2008, 02:37 AM