KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > UserTheme


1 import javax.swing.plaf.*;
2 import javax.swing.plaf.metal.*;
3 import javax.swing.*;
4 import java.awt.*;
5
6 /** Class that describes a Metal Look and Feel theme,
7 * based on user preferences.*/

8 public class UserTheme extends DefaultMetalTheme{
9     
10     private final ColorUIResource primary1;
11     private final ColorUIResource primary2;
12     private final ColorUIResource primary3;
13     private final ColorUIResource secondary1;
14     private final ColorUIResource secondary2;
15     private final ColorUIResource secondary3;
16         
17     private final FontUIResource user;
18     private final FontUIResource system;
19     /** Creates theme based on user preferences file.*/
20     public UserTheme(ColorUIResource p1,ColorUIResource p2, ColorUIResource p3,ColorUIResource s1, ColorUIResource s2, ColorUIResource s3,FontUIResource u,FontUIResource s){
21         this.primary1=p1;
22         this.primary2=p2;
23         this.primary3=p3;
24         this.secondary1=s1;
25         this.secondary2=s2;
26         this.secondary3=s3;
27         this.user=u;
28         this.system=s;
29     }
30     
31     
32     
33     /** Returns UserTheme:*/
34     public String JavaDoc getName(){
35         return "UserTheme";
36     }
37     
38     // Overidden get methods
39
protected ColorUIResource getPrimary1() { return primary1; }
40     protected ColorUIResource getPrimary2() { return primary2; }
41     protected ColorUIResource getPrimary3() { return primary3; }
42
43     protected ColorUIResource getSecondary1() { return secondary1; }
44     protected ColorUIResource getSecondary2() { return secondary2; }
45     protected ColorUIResource getSecondary3() { return secondary3; }
46     
47     //public FontUIResource getUserTextFont() { return user; }
48
//public FontUIResource getSystemTextFont() { return system; }
49
}
Popular Tags