KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > importscrubber > WorkingCellRenderer


1 package net.sourceforge.importscrubber;
2
3 import java.awt.Component JavaDoc;
4 import java.awt.Font JavaDoc;
5 import javax.swing.*;
6
7 /**
8  * Encapsulates the appearance of an item in the file list.
9  */

10 public class WorkingCellRenderer extends DefaultListCellRenderer implements ListCellRenderer
11 {
12
13     private final Font JavaDoc _bold = new Font JavaDoc("Arial", Font.BOLD, 10);
14     private final Font JavaDoc _normal = new Font JavaDoc("Arial", Font.PLAIN, 10);
15
16     public Component JavaDoc getListCellRendererComponent(JList list, Object JavaDoc value, int index, boolean isSelected, boolean cellHasFocus)
17     {
18         super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
19         if (isSelected) {
20             setBorder(BorderFactory.createRaisedBevelBorder());
21             setFont(_bold);
22         } else {
23             setBorder(BorderFactory.createEmptyBorder());
24             setFont(_normal);
25         }
26         return this;
27     }
28 }
29
30
Popular Tags