View Javadoc

1   /*
2    * Copyright (c) 2003-2008 by Cosylab d. d.
3    *
4    * This file is part of CosyBeans-Common.
5    *
6    * CosyBeans-Common is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * CosyBeans-Common is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with CosyBeans-Common.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package com.cosylab.gui.components.util;
21  
22  import java.awt.Color;
23  
24  import javax.swing.plaf.ColorUIResource;
25  import javax.swing.plaf.FontUIResource;
26  import javax.swing.plaf.metal.MetalLookAndFeel;
27  import javax.swing.plaf.metal.MetalTheme;
28  
29  
30  /**
31   * A color and font theme used for MetalLookAndFeel.
32   *
33   * @author <a href="mailto:miha.kadunc@cosylab.com">Miha Kadunc</a>
34   * @version $id$
35   */
36  public class CosyMetalTheme extends MetalTheme {
37      private static final ColorUIResource primary1 = new ColorUIResource(102,
38              102, 153);
39      private static final ColorUIResource primary2 = new ColorUIResource(153,
40              153, 204);
41      private static final ColorUIResource primary3 = new ColorUIResource(204,
42              204, 255);
43      private static final ColorUIResource secondary1 = new ColorUIResource(102,
44              102, 102);
45      private static final ColorUIResource secondary2 = new ColorUIResource(153,
46              153, 153);
47      private static final ColorUIResource secondary3 = new ColorUIResource(204,
48              204, 204);
49  
50      /*
51        private static final ColorUIResource primary1=new ColorUIResource(SystemColor.inactiveCaption);
52              private static final ColorUIResource primary2=new ColorUIResource(SystemColor.activeCaption);
53              private static final ColorUIResource primary3=new ColorUIResource(SystemColor.info);
54  
55              private static final ColorUIResource secondary1=new ColorUIResource(SystemColor.controlDkShadow);
56              private static final ColorUIResource secondary2=new ColorUIResource(SystemColor.controlShadow);
57              private static final ColorUIResource secondary3=new ColorUIResource(SystemColor.control);
58      */
59      private static final ColorUIResource white = new ColorUIResource(Color.white);
60      private static final ColorUIResource black = new ColorUIResource(Color.black);
61      private static final FontUIResource controlFont = MetalLookAndFeel.getControlTextFont();
62      private static final FontUIResource menuFont = MetalLookAndFeel.getMenuTextFont();
63      private static final FontUIResource subFont = MetalLookAndFeel.getSubTextFont();
64      private static final FontUIResource systemFont = MetalLookAndFeel.getSystemTextFont();
65      private static final FontUIResource windowFont = MetalLookAndFeel.getWindowTitleFont();
66      private static final FontUIResource userFont = MetalLookAndFeel.getUserTextFont();
67  
68      /**
69       * @see MetalTheme#getName()
70       */
71      public String getName() {
72          return "CosyBeans Metal Theme";
73      }
74  
75      /**
76       * @see MetalTheme#getPrimary1()
77       */
78      protected ColorUIResource getPrimary1() {
79          return primary1;
80      }
81  
82      /**
83       * @see MetalTheme#getPrimary2()
84       */
85      protected ColorUIResource getPrimary2() {
86          return primary2;
87      }
88  
89      /**
90       * @see MetalTheme#getPrimary3()
91       */
92      protected ColorUIResource getPrimary3() {
93          return primary3;
94      }
95  
96      /**
97       * @see MetalTheme#getSecondary1()
98       */
99      protected ColorUIResource getSecondary1() {
100         return secondary1;
101     }
102 
103     /**
104      * @see MetalTheme#getSecondary2()
105      */
106     protected ColorUIResource getSecondary2() {
107         return secondary2;
108     }
109 
110     /**
111      * @see MetalTheme#getSecondary3()
112      */
113     protected ColorUIResource getSecondary3() {
114         return secondary3;
115     }
116 
117     /**
118      * @see MetalTheme#getControlTextFont()
119      */
120     public FontUIResource getControlTextFont() {
121         return controlFont;
122     }
123 
124     /**
125      * @see MetalTheme#getSystemTextFont()
126      */
127     public FontUIResource getSystemTextFont() {
128         return systemFont;
129     }
130 
131     /**
132      * @see MetalTheme#getUserTextFont()
133      */
134     public FontUIResource getUserTextFont() {
135         return userFont;
136     }
137 
138     /**
139      * @see MetalTheme#getMenuTextFont()
140      */
141     public FontUIResource getMenuTextFont() {
142         return menuFont;
143     }
144 
145     /**
146      * @see MetalTheme#getWindowTitleFont()
147      */
148     public FontUIResource getWindowTitleFont() {
149         return windowFont;
150     }
151 
152     /**
153      * @see MetalTheme#getSubTextFont()
154      */
155     public FontUIResource getSubTextFont() {
156         return subFont;
157     }
158 
159     /**
160      * @see javax.swing.plaf.metal.MetalTheme#getBlack()
161      */
162     protected ColorUIResource getBlack() {
163         return black;
164     }
165 
166     /**
167      * @see javax.swing.plaf.metal.MetalTheme#getWhite()
168      */
169     protected ColorUIResource getWhite() {
170         return white;
171     }
172 }