001: /*
002: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
003: *
004: * http://izpack.org/
005: * http://izpack.codehaus.org/
006: *
007: * Licensed under the Apache License, Version 2.0 (the "License");
008: * you may not use this file except in compliance with the License.
009: * You may obtain a copy of the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS,
015: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016: * See the License for the specific language governing permissions and
017: * limitations under the License.
018: */
019:
020: package com.izforge.izpack.gui;
021:
022: import java.awt.Font;
023:
024: import javax.swing.plaf.ColorUIResource;
025: import javax.swing.plaf.FontUIResource;
026: import javax.swing.plaf.metal.DefaultMetalTheme;
027:
028: /**
029: * The IzPack metal theme.
030: *
031: * @author Julien Ponge
032: */
033: public class IzPackMetalTheme extends DefaultMetalTheme {
034:
035: /** The fonts color. */
036: private ColorUIResource color;
037:
038: private FontUIResource controlFont;
039:
040: private FontUIResource menuFont;
041:
042: private FontUIResource windowTitleFont;
043:
044: /** The constructor. */
045: public IzPackMetalTheme() {
046: color = new ColorUIResource(0, 0, 0);
047:
048: Font font1 = createFont("Tahoma", Font.PLAIN, 11);
049: Font font2 = createFont("Tahoma", Font.BOLD, 11);
050:
051: menuFont = new FontUIResource(font1);
052: controlFont = new FontUIResource(font1);
053: windowTitleFont = new FontUIResource(font2);
054: }
055:
056: private Font createFont(String name, int style, int size) {
057: Font font = new Font(name, style, size);
058: return ((font == null) ? new Font("Dialog", style, size) : font);
059: }
060:
061: /**
062: * Returns the color.
063: *
064: * @return The color.
065: */
066: public ColorUIResource getControlTextColor() {
067: return color;
068: }
069:
070: /**
071: * Returns the color.
072: *
073: * @return The color.
074: */
075: public ColorUIResource getMenuTextColor() {
076: return color;
077: }
078:
079: /**
080: * Returns the color.
081: *
082: * @return The color.
083: */
084: public ColorUIResource getSystemTextColor() {
085: return color;
086: }
087:
088: /**
089: * Returns the color.
090: *
091: * @return The color.
092: */
093: public ColorUIResource getUserTextColor() {
094: return color;
095: }
096:
097: /**
098: * The Font of Labels in many cases
099: */
100: public FontUIResource getControlTextFont() {
101: return controlFont;
102: }
103:
104: /**
105: * The Font of Menus and MenuItems
106: */
107: public FontUIResource getMenuTextFont() {
108: return menuFont;
109: }
110:
111: /**
112: * The Font of Nodes in JTrees
113: */
114: public FontUIResource getSystemTextFont() {
115: return controlFont;
116: }
117:
118: /**
119: * The Font in TextFields, EditorPanes, etc.
120: */
121: public FontUIResource getUserTextFont() {
122: return controlFont;
123: }
124:
125: /**
126: * The Font of the Title of JInternalFrames
127: */
128: public FontUIResource getWindowTitleFont() {
129: return windowTitleFont;
130: }
131:
132: }
|