001: /*
002: * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions
006: * are met:
007: *
008: * -Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: *
011: * -Redistribution in binary form must reproduct the above copyright
012: * notice, this list of conditions and the following disclaimer in
013: * the documentation and/or other materials provided with the distribution.
014: *
015: * Neither the name of Sun Microsystems, Inc. or the names of contributors
016: * may be used to endorse or promote products derived from this software
017: * without specific prior written permission.
018: *
019: * This software is provided "AS IS," without a warranty of any kind. ALL
020: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
021: * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
022: * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT
023: * BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
024: * OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
025: * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
026: * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
027: * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
028: * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
029: * IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
030: *
031: * You acknowledge that Software is not designed, licensed or intended for
032: * use in the design, construction, operation or maintenance of any nuclear
033: * facility.
034: */
035:
036: /*
037: * @(#)ContrastTheme.java 1.9 03/12/19
038: */
039: package br.com.gfpshare.plaf.theme;
040:
041: import javax.swing.UIDefaults;
042: import javax.swing.border.Border;
043: import javax.swing.border.CompoundBorder;
044: import javax.swing.border.LineBorder;
045: import javax.swing.plaf.BorderUIResource;
046: import javax.swing.plaf.ColorUIResource;
047: import javax.swing.plaf.basic.BasicBorders;
048: import javax.swing.plaf.metal.DefaultMetalTheme;
049:
050: /**
051: * This class describes a higher-contrast Metal Theme.
052: *
053: * @version 1.9 12/19/03
054: * @author Michael C. Albers
055: */
056:
057: public class ContrastTheme extends DefaultMetalTheme {
058:
059: /**
060: * @see javax.swing.plaf.metal.DefaultMetalTheme#getName()
061: */
062: @Override
063: public String getName() {
064: return "Contrast";
065: }
066:
067: private final ColorUIResource primary1 = new ColorUIResource(0, 0,
068: 0);
069: private final ColorUIResource primary2 = new ColorUIResource(204,
070: 204, 204);
071: private final ColorUIResource primary3 = new ColorUIResource(255,
072: 255, 255);
073: private final ColorUIResource primaryHighlight = new ColorUIResource(
074: 102, 102, 102);
075:
076: private final ColorUIResource secondary2 = new ColorUIResource(204,
077: 204, 204);
078: private final ColorUIResource secondary3 = new ColorUIResource(255,
079: 255, 255);
080: @SuppressWarnings("unused")
081: private final ColorUIResource controlHighlight = new ColorUIResource(
082: 102, 102, 102);
083:
084: @Override
085: protected ColorUIResource getPrimary1() {
086: return primary1;
087: }
088:
089: @Override
090: protected ColorUIResource getPrimary2() {
091: return primary2;
092: }
093:
094: @Override
095: protected ColorUIResource getPrimary3() {
096: return primary3;
097: }
098:
099: /**
100: * @see javax.swing.plaf.metal.MetalTheme#getPrimaryControlHighlight()
101: */
102: @Override
103: public ColorUIResource getPrimaryControlHighlight() {
104: return primaryHighlight;
105: }
106:
107: @Override
108: protected ColorUIResource getSecondary2() {
109: return secondary2;
110: }
111:
112: @Override
113: protected ColorUIResource getSecondary3() {
114: return secondary3;
115: }
116:
117: /**
118: * @see javax.swing.plaf.metal.MetalTheme#getControlHighlight()
119: */
120: @Override
121: public ColorUIResource getControlHighlight() {
122: return super .getSecondary3();
123: }
124:
125: /**
126: * @see javax.swing.plaf.metal.MetalTheme#getFocusColor()
127: */
128: @Override
129: public ColorUIResource getFocusColor() {
130: return getBlack();
131: }
132:
133: /**
134: * @see javax.swing.plaf.metal.MetalTheme#getTextHighlightColor()
135: */
136: @Override
137: public ColorUIResource getTextHighlightColor() {
138: return getBlack();
139: }
140:
141: /**
142: * @see javax.swing.plaf.metal.MetalTheme#getHighlightedTextColor()
143: */
144: @Override
145: public ColorUIResource getHighlightedTextColor() {
146: return getWhite();
147: }
148:
149: /**
150: * @see javax.swing.plaf.metal.MetalTheme#getMenuSelectedBackground()
151: */
152: @Override
153: public ColorUIResource getMenuSelectedBackground() {
154: return getBlack();
155: }
156:
157: /**
158: * @see javax.swing.plaf.metal.MetalTheme#getMenuSelectedForeground()
159: */
160: @Override
161: public ColorUIResource getMenuSelectedForeground() {
162: return getWhite();
163: }
164:
165: /**
166: * @see javax.swing.plaf.metal.MetalTheme#getAcceleratorForeground()
167: */
168: @Override
169: public ColorUIResource getAcceleratorForeground() {
170: return getBlack();
171: }
172:
173: /**
174: * @see javax.swing.plaf.metal.MetalTheme#getAcceleratorSelectedForeground()
175: */
176: @Override
177: public ColorUIResource getAcceleratorSelectedForeground() {
178: return getWhite();
179: }
180:
181: /**
182: * @see javax.swing.plaf.metal.MetalTheme#addCustomEntriesToTable(javax.swing.UIDefaults)
183: */
184: @Override
185: public void addCustomEntriesToTable(UIDefaults table) {
186:
187: Border blackLineBorder = new BorderUIResource(new LineBorder(
188: getBlack()));
189:
190: Object textBorder = new BorderUIResource(new CompoundBorder(
191: blackLineBorder, new BasicBorders.MarginBorder()));
192:
193: table.put("ToolTip.border", blackLineBorder);
194: table.put("TitledBorder.border", blackLineBorder);
195:
196: table.put("TextField.border", textBorder);
197: table.put("PasswordField.border", textBorder);
198: table.put("TextArea.border", textBorder);
199: table.put("TextPane.border", textBorder);
200: table.put("EditorPane.border", textBorder);
201:
202: }
203:
204: }
|