
70
|
Chapter 2, Lists and Combos
#16 Make Different List Items Look Different
HACK
When you click on items in the list, their selection state is shown with
checkboxes, as seen in Figure 2-6.
Notice how the checkboxes are all you need to see what’s selected. In an
early version of this hack, I went out of my way to maintain the usual selec-
tion colors and it looked lousy, probably because there were two competing
metaphors to show the selection: the highlight and the checkbox. Since this
hack totally changes how the JList works, it’s appropriate to radically
change its appearance, too.
H A C K
#16
Make Different List Items Look Different Hack #16
An in-progress download shouldn’t look like a completed one.
What made me love lists again were the OmniWeb browser and (later)
Safari—particularly, their download managers. By way of negative example,
take the download manager for Internet Explorer 5 for Mac...please. This
GUI was a table of filenames, URLs, sizes, etc., with columns not even intel-
ligently resized for their widths. OmniWeb, on the other hand, showed a
running download with a progress bar, and a finished download with the
defaultComp.getListCellRendererComponent (list, value, index,
isSelected, cellHasFocus);
checkbox.setSelected (isSelected);
Component[] comps = getComponents( );
for (int i=0; i<comps.length; i++) {
comps[i].setForeground (listForeground);
comps[i].setBackground (listBackground); ...