KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jgoodies > looks > plastic > theme > InvertedColorTheme


1 /*
2  * Copyright (c) 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * o Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * o Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * o Neither the name of JGoodies Karsten Lentzsch nor the names of
15  * its contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package com.jgoodies.looks.plastic.theme;
32
33 import java.awt.Color JavaDoc;
34 import java.awt.Font JavaDoc;
35
36 import javax.swing.UIDefaults JavaDoc;
37 import javax.swing.plaf.ColorUIResource JavaDoc;
38 import javax.swing.plaf.FontUIResource JavaDoc;
39
40 import com.jgoodies.looks.FontSizeHints;
41 import com.jgoodies.looks.plastic.PlasticLookAndFeel;
42 import com.jgoodies.looks.plastic.PlasticTheme;
43
44 /**
45  * The abstract superclass of all inverted Plastic themes,
46  * that have light foreground and dark window background colors.
47  *
48  * @author Karsten Lentzsch
49  * @version $Revision: 1.2 $
50  */

51 public abstract class InvertedColorTheme extends PlasticTheme {
52
53     private final ColorUIResource JavaDoc softWhite =
54         new ColorUIResource JavaDoc(154, 154, 154);
55
56     private final ColorUIResource JavaDoc primary1 = new ColorUIResource JavaDoc(83, 83, 61);
57     //90, 90, 66);// Dunkel: Rollbalkenrahmen-Dunkel
58

59     private final ColorUIResource JavaDoc primary2 = new ColorUIResource JavaDoc(115, 107, 82);
60     //132, 123, 90);// Mittel: Rollbalkenhintergrund
61

62     private final ColorUIResource JavaDoc primary3 = new ColorUIResource JavaDoc(156, 156, 123);
63     //148, 140, 107); //181, 173, 148); // Hell: Ordnerfläche, Selektion, Rollbalken-Hoch, Menühintergrund
64

65     private final ColorUIResource JavaDoc secondary1 = new ColorUIResource JavaDoc(32, 32, 32);
66     // Abwärts (dunkler)73, 59, 23);
67

68     private final ColorUIResource JavaDoc secondary2 = new ColorUIResource JavaDoc(96, 96, 96);
69     // Aufwärts (heller)136, 112, 46);
70

71     private final ColorUIResource JavaDoc secondary3 = new ColorUIResource JavaDoc(84, 84, 84);
72     // Fläche 134, 104, 22);
73

74     public ColorUIResource JavaDoc getSimpleInternalFrameBackground() {
75         return getWhite();
76     }
77
78     public void addCustomEntriesToTable(UIDefaults JavaDoc table) {
79         super.addCustomEntriesToTable(table);
80         Object JavaDoc[] uiDefaults =
81             {
82                 "jgoodies.useControlGradient",
83                 Boolean.TRUE,
84                 "TextField.ineditableForeground",
85                 getSoftWhite(),
86             //table.get("controlText")};
87
"Plastic.brightenStop",
88                 new Color JavaDoc(255, 255, 255, 20),
89                 "Plastic.ltBrightenStop",
90                 new Color JavaDoc(255, 255, 255, 16),
91                 };
92         table.putDefaults(uiDefaults);
93     }
94
95     protected FontUIResource JavaDoc getFont() {
96         if (null == controlFont)
97             controlFont = new FontUIResource JavaDoc(getFont0());
98
99         return controlFont;
100     }
101
102     protected Font JavaDoc getFont0() {
103         FontSizeHints sizeHints = PlasticLookAndFeel.getFontSizeHints();
104         return getFont0(sizeHints.controlFontSize());
105     }
106
107     protected Font JavaDoc getFont0(int size) {
108         return new Font JavaDoc("Tahoma", Font.PLAIN, size);
109     }
110
111     public FontUIResource JavaDoc getSubTextFont() {
112         if (null == smallFont) {
113             smallFont = new FontUIResource JavaDoc(getFont0(10));
114         }
115         return smallFont;
116     }
117
118     public ColorUIResource JavaDoc getControlDisabled() {
119         return getSoftWhite();
120     }
121     
122     public ColorUIResource JavaDoc getControlHighlight() {
123         return getSoftWhite();
124     }
125     
126     public ColorUIResource JavaDoc getControlInfo() {
127         return getWhite();
128     }
129     
130     public ColorUIResource JavaDoc getInactiveSystemTextColor() {
131         return getSoftWhite();
132     }
133     
134     public ColorUIResource JavaDoc getMenuDisabledForeground() {
135         return getSoftWhite();
136     }
137     
138     public ColorUIResource JavaDoc getMenuItemSelectedBackground() {
139         return getPrimary3();
140     }
141     
142     public ColorUIResource JavaDoc getMenuItemSelectedForeground() {
143         return getBlack();
144     }
145     
146     public ColorUIResource JavaDoc getMenuSelectedBackground() {
147         return getPrimary2();
148     }
149     
150     public ColorUIResource JavaDoc getMenuSelectedForeground() {
151         return getWhite();
152     }
153     
154     protected ColorUIResource JavaDoc getPrimary1() {
155         return primary1;
156     }
157     
158     protected ColorUIResource JavaDoc getPrimary2() {
159         return primary2;
160     }
161     
162     protected ColorUIResource JavaDoc getPrimary3() {
163         return primary3;
164     }
165     public ColorUIResource JavaDoc getPrimaryControlHighlight() {
166         return getSoftWhite();
167     }
168     
169     protected ColorUIResource JavaDoc getSecondary1() {
170         return secondary1;
171     }
172     
173     protected ColorUIResource JavaDoc getSecondary2() {
174         return secondary2;
175     }
176     
177     protected ColorUIResource JavaDoc getSecondary3() {
178         return secondary3;
179     }
180     
181     public ColorUIResource JavaDoc getSeparatorBackground() {
182         return getSoftWhite();
183     }
184     
185     protected ColorUIResource JavaDoc getSoftWhite() {
186         return softWhite;
187     }
188     
189     public ColorUIResource JavaDoc getTitleTextColor() {
190         return getControlInfo();
191     }
192     
193     public ColorUIResource JavaDoc getToggleButtonCheckColor() {
194         return getWhite();
195     }
196
197     public ColorUIResource JavaDoc getFocusColor() {
198         return Colors.GRAY_FOCUS;
199     }
200
201 // public FontUIResource getControlTextFont() {
202
// return getFont();
203
// }
204
//
205
// public FontUIResource getMenuTextFont() {
206
// return getFont();
207
// }
208
//
209
// public FontUIResource getWindowTitleFont() {
210
// return getFont();
211
// }
212
//
213
// public FontUIResource getSystemTextFont() {
214
// return getFont();
215
// }
216
//
217
// public FontUIResource getUserTextFont() {
218
// return getFont();
219
// }
220

221 }
222
Popular Tags