KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > pooka > gui > filter > ColorDisplayFilter


1 package net.suberic.pooka.gui.filter;
2 import java.awt.*;
3
4
5 /**
6  * A DisplayFilter which changes the color of the given messages in
7  * the FolderDisplayPanel to the selected color.
8  */

9 public class ColorDisplayFilter implements DisplayFilter {
10   
11   Color newColor;
12   
13   /**
14    * Creates a new ColorDisplayFilter.
15    */

16   public ColorDisplayFilter() {
17   }
18   
19   /**
20    * a no-op.
21    */

22   public java.util.List JavaDoc performFilter(java.util.List JavaDoc tmp) {
23     return tmp;
24   }
25   
26   /**
27    * Configures the filter from the given property.
28    */

29   public void initializeFilter(String JavaDoc propertyName) {
30     try {
31       newColor = new Color(Integer.parseInt(net.suberic.pooka.Pooka.getProperty(propertyName + ".rgb", "742")));
32     } catch (Exception JavaDoc e) {
33       newColor = new Color(742);
34     }
35     
36   }
37   
38   /**
39    * Applies the filter to the given component.
40    */

41   public void apply(java.awt.Component JavaDoc target) {
42     target.setForeground(newColor);
43   }
44 }
45
Popular Tags