001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
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
020package com.izforge.izpack.gui;
021
022import java.awt.Font;
023
024import javax.swing.plaf.ColorUIResource;
025import javax.swing.plaf.FontUIResource;
026import javax.swing.plaf.metal.DefaultMetalTheme;
027
028/**
029 * The IzPack metal theme.
030 * 
031 * @author Julien Ponge
032 */
033public class IzPackMetalTheme extends DefaultMetalTheme
034{
035
036    /** The fonts color. */
037    private ColorUIResource color;
038
039    private FontUIResource controlFont;
040
041    private FontUIResource menuFont;
042
043    private FontUIResource windowTitleFont;
044
045    /** The constructor. */
046    public IzPackMetalTheme()
047    {
048        color = new ColorUIResource(0, 0, 0);
049
050        Font font1 = createFont("Tahoma", Font.PLAIN, 11);
051        Font font2 = createFont("Tahoma", Font.BOLD, 11);
052
053        menuFont = new FontUIResource(font1);
054        controlFont = new FontUIResource(font1);
055        windowTitleFont = new FontUIResource(font2);
056    }
057
058    private Font createFont(String name, int style, int size)
059    {
060        Font font = new Font(name, style, size);
061        return ((font == null) ? new Font("Dialog", style, size) : font);
062    }
063
064    /**
065     * Returns the color.
066     * 
067     * @return The color.
068     */
069    public ColorUIResource getControlTextColor()
070    {
071        return color;
072    }
073
074    /**
075     * Returns the color.
076     * 
077     * @return The color.
078     */
079    public ColorUIResource getMenuTextColor()
080    {
081        return color;
082    }
083
084    /**
085     * Returns the color.
086     * 
087     * @return The color.
088     */
089    public ColorUIResource getSystemTextColor()
090    {
091        return color;
092    }
093
094    /**
095     * Returns the color.
096     * 
097     * @return The color.
098     */
099    public ColorUIResource getUserTextColor()
100    {
101        return color;
102    }
103
104    /**
105     * The Font of Labels in many cases
106     */
107    public FontUIResource getControlTextFont()
108    {
109        return controlFont;
110    }
111
112    /**
113     * The Font of Menus and MenuItems
114     */
115    public FontUIResource getMenuTextFont()
116    {
117        return menuFont;
118    }
119
120    /**
121     * The Font of Nodes in JTrees
122     */
123    public FontUIResource getSystemTextFont()
124    {
125        return controlFont;
126    }
127
128    /**
129     * The Font in TextFields, EditorPanes, etc.
130     */
131    public FontUIResource getUserTextFont()
132    {
133        return controlFont;
134    }
135
136    /**
137     * The Font of the Title of JInternalFrames
138     */
139    public FontUIResource getWindowTitleFont()
140    {
141        return windowTitleFont;
142    }
143
144}