001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: * @author Sergey Burlak
020: * @version $Revision$
021: */package javax.swing.plaf.metal;
022:
023: import java.awt.Font;
024:
025: import javax.swing.plaf.ColorUIResource;
026: import javax.swing.plaf.FontUIResource;
027:
028: public class DefaultMetalTheme extends MetalTheme {
029: private static ColorUIResource primaryColor1 = new ColorUIResource(
030: 0x20, 0x50, 0x80);
031: private static ColorUIResource primaryColor2 = new ColorUIResource(
032: 0x50, 0x80, 0xC0);
033: private static ColorUIResource primaryColor3 = new ColorUIResource(
034: 0xC0, 0xE0, 0xFF);
035: private static ColorUIResource secondaryColor1 = new ColorUIResource(
036: 0x50, 0x50, 0x50);
037: private static ColorUIResource secondaryColor2 = new ColorUIResource(
038: 0x80, 0x80, 0x80);
039: private static ColorUIResource secondaryColor3 = new ColorUIResource(
040: 0xE0, 0xE0, 0xE0);
041:
042: private FontUIResource systemFont;
043: private FontUIResource smallFont;
044: private FontUIResource controlFont;
045: private FontUIResource userFont;
046:
047: public FontUIResource getUserTextFont() {
048: if (userFont == null) {
049: userFont = getFont("swing.plaf.metal.userFont",
050: new FontUIResource("Dialog", FontUIResource.PLAIN,
051: 12));
052: }
053:
054: return userFont;
055: }
056:
057: public FontUIResource getSystemTextFont() {
058: if (systemFont == null) {
059: systemFont = getFont("swing.plaf.metal.systemFont",
060: new FontUIResource("Dialog", FontUIResource.PLAIN,
061: 12));
062: }
063:
064: return systemFont;
065: }
066:
067: public FontUIResource getSubTextFont() {
068: if (smallFont == null) {
069: smallFont = getFont("swing.plaf.metal.smallFont",
070: new FontUIResource("Dialog", FontUIResource.PLAIN,
071: 10));
072: }
073:
074: return smallFont;
075: }
076:
077: public FontUIResource getControlTextFont() {
078: if (controlFont == null) {
079: controlFont = getFont("swing.plaf.metal.controlFont",
080: new FontUIResource("Dialog", FontUIResource.BOLD,
081: 12));
082: }
083:
084: return controlFont;
085: }
086:
087: public FontUIResource getWindowTitleFont() {
088: return getControlTextFont();
089: }
090:
091: public FontUIResource getMenuTextFont() {
092: return getControlTextFont();
093: }
094:
095: protected ColorUIResource getSecondary3() {
096: return secondaryColor3;
097: }
098:
099: protected ColorUIResource getSecondary2() {
100: return secondaryColor2;
101: }
102:
103: protected ColorUIResource getSecondary1() {
104: return secondaryColor1;
105: }
106:
107: protected ColorUIResource getPrimary3() {
108: return primaryColor3;
109: }
110:
111: protected ColorUIResource getPrimary2() {
112: return primaryColor2;
113: }
114:
115: protected ColorUIResource getPrimary1() {
116: return primaryColor1;
117: }
118:
119: public String getName() {
120: return "Steel";
121: }
122:
123: private FontUIResource getFont(final String propertyName,
124: final FontUIResource defaultFont) {
125: String propertyValue = System.getProperty(propertyName);
126: if (propertyValue != null) {
127: return new FontUIResource(Font.decode(propertyValue));
128: } else {
129: return defaultFont;
130: }
131: }
132: }
|