1 /* DefaultMetalTheme.java -- A modern theme for the Metal L&F
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath 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 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax
.swing
.plaf
.metal
;
40 import java
.awt
.Color
;
41 import java
.util
.Arrays
;
43 import javax
.swing
.UIDefaults
;
44 import javax
.swing
.plaf
.ColorUIResource
;
47 * A modern theme for the Metal Look & Feel.
50 * @author Roman Kennke (roman@kennke.org)
52 public class OceanTheme
extends DefaultMetalTheme
55 * The OceanTheme value for black.
57 static final ColorUIResource BLACK
= new ColorUIResource(51, 51, 51);
60 * The OceanTheme value for primary1.
62 static final ColorUIResource PRIMARY1
= new ColorUIResource(99, 130, 191);
65 * The OceanTheme value for primary1.
67 static final ColorUIResource PRIMARY2
= new ColorUIResource(163, 184, 204);
70 * The OceanTheme value for primary1.
72 static final ColorUIResource PRIMARY3
= new ColorUIResource(184, 207, 229);
75 * The OceanTheme value for secondary1.
77 static final ColorUIResource SECONDARY1
= new ColorUIResource(122, 138, 153);
80 * The OceanTheme value for secondary2.
82 static final ColorUIResource SECONDARY2
= new ColorUIResource(184, 207, 229);
85 * The OceanTheme value for secondary3.
87 static final ColorUIResource SECONDARY3
= new ColorUIResource(238, 238, 238);
90 * The OceanTheme value for inactive control text.
92 static final ColorUIResource INACTIVE_CONTROL_TEXT
=
93 new ColorUIResource(153, 153, 153);
96 * Returns the name of this theme, "Ocean"
98 public String
getName()
104 * Returns the color for control text, which is the
105 * value of the theme's black value.
107 public ColorUIResource
getControlTextColor()
113 * Returns the desktop color, which is the theme's white color.
115 public ColorUIResource
getDesktopColor()
121 * Returns the color for inactive control text, which is the
122 * RGB value (153, 153, 153).
124 public ColorUIResource
getInactiveControlTextColor()
126 return INACTIVE_CONTROL_TEXT
;
130 * Returns the OceanTheme's color for disabled menu foreground,
133 public ColorUIResource
getMenuDisabledForeground()
135 return INACTIVE_CONTROL_TEXT
;
140 * Returns the OceanTheme's color for black, the RGB value
143 * @return Returns the OceanTheme's value for black
145 protected ColorUIResource
getBlack()
151 * Return the OceanTheme's value for primary 1, the RGB value
154 protected ColorUIResource
getPrimary1()
160 * Return the OceanTheme's value for primary 2, the RGB value
163 protected ColorUIResource
getPrimary2()
169 * Return the OceanTheme's value for primary 1, the RGB value
172 protected ColorUIResource
getPrimary3()
178 * Return the OceanTheme's value for secondary 1, the RGB value
181 protected ColorUIResource
getSecondary1()
187 * Return the OceanTheme's value for secondary 2, the RGB value
190 protected ColorUIResource
getSecondary2()
195 * Return the OceanTheme's value for secondary 3, the RGB value
198 protected ColorUIResource
getSecondary3()
204 * Adds customized entries to the UIDefaults table.
206 * @param defaults the UI defaults table
208 public void addCustomEntriesToTable(UIDefaults defaults
)
210 defaults
.put("Button.gradient", Arrays
.asList(new Object
[]
211 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
212 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
213 defaults
.put("CheckBox.gradient", Arrays
.asList(new Object
[]
214 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
215 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
216 defaults
.put("CheckBoxMenuItem.gradient", Arrays
.asList(new Object
[]
217 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
218 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
219 defaults
.put("MenuBar.gradient", Arrays
.asList(new Object
[]
220 {new Double(1.0), new Double(0.0), new ColorUIResource(Color
.WHITE
),
221 new ColorUIResource(218, 218, 218), new ColorUIResource(218, 218, 218)}));
222 defaults
.put("RadioButton.gradient", Arrays
.asList(new Object
[]
223 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
224 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
225 defaults
.put("RadioButtonMenuItem.gradient", Arrays
.asList(new Object
[]
226 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
227 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
228 defaults
.put("ScrollBar.gradient", Arrays
.asList(new Object
[]
229 {new Double(1.0), new Double(0.0), new ColorUIResource(Color
.WHITE
),
230 new ColorUIResource(218, 218, 218), new ColorUIResource(218, 218, 218)}));
231 defaults
.put("Slider.gradient", Arrays
.asList(new Object
[]
232 {new Double(0.3), new Double(0.2), new ColorUIResource(200, 221, 242),
233 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
234 defaults
.put("ToggleButton.gradient", Arrays
.asList(new Object
[]
235 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
236 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
237 defaults
.put("InternalFrame.activeTitleGradient", Arrays
.asList(new Object
[]
238 {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
239 new ColorUIResource(Color
.WHITE
), new ColorUIResource(184, 207, 229)}));
241 defaults
.put("Button.rollover", Boolean
.TRUE
);