Charles Burton wrote:I want these buttons to act like filters so that when they are pressed the jlist only shows items related to that button.
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:That's a lot of code to go through, so I didn't.
Charles Burton wrote:I want these buttons to act like filters so that when they are pressed the jlist only shows items related to that button.
Have you considered using a single column JTable with a RowFilter?
Michael Dunn wrote:> I want these buttons to act like filters so that when they are pressed the jlist only shows items related to that button.
when the program starts create listModels for all the buttons, and an 'overall' listModel. Jlist opens with 'overall' model.
whatever a button is clicked, it sets the model of the JList to the model relative to that button clicked.
Charles Burton wrote:the problem is that RowFilter is a Java 6 thing, and I have to work with the lowest common version which is 1.4.
Charles Burton wrote:do you think the best way would be to extend JButton and then use that model as the internal tracker for what to render? Also, I would just have to call repaint() on the JList and it would draw it with the new information whenever I set the model from the button right?
Charles Burton wrote:Also, if I do use the model backed buttons. Just for advice, would it make more sense to have a model that contains all the messages when I want to show all of them or would it be better to just go through the buttons and construct one on the fly from the values contained in each?
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.
if a new item is added from another update, that one shows up in the filtered results.
luck, db
There are no new questions, but there may be new answers.
You have a filteredList.add(li); that is unconditionally executed when filter is not the empty String (line 37). That should probably be wrapped in the same condition you use in setFilter(...) -- if (filter.equals(li.getSource())
I'm not sure if you're familiar with the Dice algorithm
I would like to thank you as well, you've been very very helpful.
luck, db
There are no new questions, but there may be new answers.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |