
66
|
Chapter 2, Lists and Combos
#15 Make JLists Checkable
HACK
The general idea of this pop up can be modified to work in similar ways for
different kinds of searches, such as popping up a list of which field the
search is to be applied to if the list items are complex. An example of this is
a mail program in which the pop up might show the options Subject, To,
From, etc., meaning that the search is limited to finding the specified term in
only the selected field.
H A C K
#15
Make JLists Checkable Hack #15
Avoid losing 50 selections to an unshifted click.
One horrible UI problem is dealing with vast collections of things that need
to be presented to the user and made selectable. If, like me, you’ve ever had
1,000 emails in your inbox, you know what I mean. Worse, what if you pick
a bunch of items to delete, but your finger slips off the key used for multi-
selection (Alt on Windows, Command on the Mac, etc.) and you lose all of
your previous selections? Overriding the native selection behavior can make
this situation somewhat more palatable.
Because a list like this behaves differently than a normal list, it should look
different, too, so I’ve opted for a checkbox metaphor. Each item is shown
with a checkbox, and as you click more items, they get checked, and if you
select an already-checked item, it gets unchecked.
This turns out to be a little harder than expected. I once did
it without
JList, creating ...