Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / javax / swing / plaf / metal / OceanTheme.java
blob9d76ff7e808a1751505c8c9494790993992cd6ce
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)
9 any later version.
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
19 02110-1301 USA.
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
24 combination.
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.awt.Insets;
42 import java.util.Arrays;
44 import javax.swing.UIDefaults;
45 import javax.swing.plaf.ColorUIResource;
46 import javax.swing.plaf.BorderUIResource.LineBorderUIResource;
48 /**
49 * A modern theme for the Metal Look & Feel.
50 * @since 1.5
52 * @author Roman Kennke (roman@kennke.org)
54 public class OceanTheme extends DefaultMetalTheme
56 /**
57 * The OceanTheme value for black.
59 static final ColorUIResource BLACK = new ColorUIResource(51, 51, 51);
61 /**
62 * The OceanTheme value for primary1.
64 static final ColorUIResource PRIMARY1 = new ColorUIResource(99, 130, 191);
66 /**
67 * The OceanTheme value for primary1.
69 static final ColorUIResource PRIMARY2 = new ColorUIResource(163, 184, 204);
71 /**
72 * The OceanTheme value for primary1.
74 static final ColorUIResource PRIMARY3 = new ColorUIResource(184, 207, 229);
76 /**
77 * The OceanTheme value for secondary1.
79 static final ColorUIResource SECONDARY1 = new ColorUIResource(122, 138, 153);
81 /**
82 * The OceanTheme value for secondary2.
84 static final ColorUIResource SECONDARY2 = new ColorUIResource(184, 207, 229);
86 /**
87 * The OceanTheme value for secondary3.
89 static final ColorUIResource SECONDARY3 = new ColorUIResource(238, 238, 238);
91 /**
92 * The OceanTheme value for inactive control text.
94 static final ColorUIResource INACTIVE_CONTROL_TEXT =
95 new ColorUIResource(153, 153, 153);
97 /**
98 * Returns the name of this theme, "Ocean"
100 public String getName()
102 return "Ocean";
106 * Returns the color for control text, which is the
107 * value of the theme's black value.
109 public ColorUIResource getControlTextColor()
111 return getBlack();
115 * Returns the desktop color, which is the theme's white color.
117 public ColorUIResource getDesktopColor()
119 return getWhite();
123 * Returns the color for inactive control text, which is the
124 * RGB value (153, 153, 153).
126 public ColorUIResource getInactiveControlTextColor()
128 return INACTIVE_CONTROL_TEXT;
132 * Returns the OceanTheme's color for disabled menu foreground,
135 public ColorUIResource getMenuDisabledForeground()
137 return INACTIVE_CONTROL_TEXT;
142 * Returns the OceanTheme's color for black, the RGB value
143 * (51, 51, 51).
145 * @return Returns the OceanTheme's value for black
147 protected ColorUIResource getBlack()
149 return BLACK;
153 * Return the OceanTheme's value for primary 1, the RGB value
154 * (99, 130, 191).
156 protected ColorUIResource getPrimary1()
158 return PRIMARY1;
162 * Return the OceanTheme's value for primary 2, the RGB value
163 * (163, 184, 204).
165 protected ColorUIResource getPrimary2()
167 return PRIMARY2;
171 * Return the OceanTheme's value for primary 1, the RGB value
172 * (184, 207, 229).
174 protected ColorUIResource getPrimary3()
176 return PRIMARY3;
180 * Return the OceanTheme's value for secondary 1, the RGB value
181 * (122, 138, 153).
183 protected ColorUIResource getSecondary1()
185 return SECONDARY1;
189 * Return the OceanTheme's value for secondary 2, the RGB value
190 * (184, 207, 229).
192 protected ColorUIResource getSecondary2()
194 return SECONDARY2;
197 * Return the OceanTheme's value for secondary 3, the RGB value
198 * (238, 238, 238).
200 protected ColorUIResource getSecondary3()
202 return SECONDARY3;
206 * Adds customized entries to the UIDefaults table.
208 * @param defaults the UI defaults table
210 public void addCustomEntriesToTable(UIDefaults defaults)
212 // Gradients.
213 defaults.put("Button.gradient", Arrays.asList(new Object[]
214 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
215 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
216 defaults.put("CheckBox.gradient", Arrays.asList(new Object[]
217 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
218 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
219 defaults.put("CheckBoxMenuItem.gradient", Arrays.asList(new Object[]
220 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
221 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
222 defaults.put("MenuBar.gradient", Arrays.asList(new Object[]
223 {new Float(1.0), new Float(0.0), new ColorUIResource(Color.WHITE),
224 new ColorUIResource(218, 218, 218), new ColorUIResource(218, 218, 218)}));
225 defaults.put("RadioButton.gradient", Arrays.asList(new Object[]
226 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
227 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
228 defaults.put("RadioButtonMenuItem.gradient", Arrays.asList(new Object[]
229 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
230 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
231 defaults.put("ScrollBar.gradient", Arrays.asList(new Object[]
232 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
233 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
234 defaults.put("Slider.gradient", Arrays.asList(new Object[]
235 {new Float(0.3), new Float(0.2), new ColorUIResource(200, 221, 242),
236 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
237 defaults.put("Slider.focusGradient", Arrays.asList(new Object[]
238 {new Float(0.3), new Float(0.2), new ColorUIResource(200, 221, 242),
239 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
240 defaults.put("ToggleButton.gradient", Arrays.asList(new Object[]
241 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
242 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
243 defaults.put("InternalFrame.activeTitleGradient", Arrays.asList(new Object[]
244 {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
245 new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
247 // Colors.
248 ColorUIResource c1 = new ColorUIResource(200, 221, 242);
249 ColorUIResource c2 = new ColorUIResource(153, 153, 153);
250 ColorUIResource c3 = new ColorUIResource(204, 204, 204);
251 ColorUIResource c4 = new ColorUIResource(210, 226, 239);
252 ColorUIResource c5 = new ColorUIResource(218, 218, 218);
253 defaults.put("Button.disabledToolBarBorderBackground", c3);
254 defaults.put("Button.toolBarBorderBackground", c2);
255 defaults.put("Label.disabledForeground", c2);
256 defaults.put("MenuBar.borderColor", c3);
257 defaults.put("Slider.altTrackColor", c4);
258 defaults.put("SplitPane.dividerFocusColor", c1);
259 defaults.put("TabbedPane.contentAreaColor", c1);
260 defaults.put("TabbedPane.borderHightlightColor", PRIMARY1);
261 defaults.put("TabbedPane.selected", c1);
262 defaults.put("TabbedPane.tabAreaBackground", c5);
263 defaults.put("TabbedPane.unselectedBackground", SECONDARY3);
264 defaults.put("Table.gridColor", SECONDARY1);
265 defaults.put("ToolBar.borderColor", c3);
266 defaults.put("Tree.selectionBorderColor", PRIMARY1);
268 // Borders.
269 defaults.put("Table.focusCellHighlightBorder",
270 new LineBorderUIResource(getPrimary1()));
272 // Insets.
273 defaults.put("TabbedPane.contentBorderInsets", new Insets(4, 2, 3, 3));
274 defaults.put("TabbedPane.tabAreaInsets", new Insets(2, 2, 0, 6));
276 // Flags.
277 defaults.put("SplitPane.oneTouchButtonsOpaque", Boolean.FALSE);
278 defaults.put("Menu.opaque", Boolean.FALSE);
279 defaults.put("ToolBar.isRollover", Boolean.TRUE);
280 defaults.put("RadioButton.rollover", Boolean.TRUE);
281 defaults.put("CheckBox.rollover", Boolean.TRUE);
282 defaults.put("Button.rollover", Boolean.TRUE);
284 // Icons.
285 // FIXME: Add OceanTheme icons.
286 // defaults.put("Tree.leafIcon", XXX);
287 // defaults.put("Tree.expandedIcon", XXX);
288 // defaults.put("Tree.openIcon", XXX);
289 // defaults.put("Tree.closedIcon", XXX);
290 // defaults.put("Tree.collapsedIcon", XXX);
291 // defaults.put("FileChooser.newFolderIcon", XXX);
292 // defaults.put("FileChooser.homeFolderIcon", XXX);
293 // defaults.put("FileChooser.upFolderIcon", XXX);
294 // defaults.put("FileView.hardDriveIcon", XXX);
295 // defaults.put("FileView.floppyDriveIcon", XXX);
296 // defaults.put("FileView.fileIcon", XXX);
297 // defaults.put("FileView.computerIcon", XXX);
298 // defaults.put("FileView.directoryIcon", XXX);
299 // defaults.put("OptionPane.questionIcon", XXX);
300 // defaults.put("OptionPane.errorIcon", XXX);
301 // defaults.put("OptionPane.warningIcon", XXX);
302 // defaults.put("OptionPane.informationIcon", XXX);
303 // defaults.put("InternalFrame.icon", XXX);
304 // defaults.put("InternalFrame.closeIcon", XXX);
305 // defaults.put("InternalFrame.iconifyIcon", XXX);
306 // defaults.put("InternalFrame.minimizeIcon", XXX);
307 // defaults.put("InternalFrame.maximizeIcon", XXX);
308 // defaults.put("InternalFrame.paletteCloseIcon", XXX);
310 // UI classes.
311 defaults.put("MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI");
313 // Others.
314 defaults.put("Button.rolloverIconType", "ocean");