root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / gui / IzPackMetalTheme.java @ 15280
History | View | Annotate | Download (3.34 KB)
1 | 15280 | rgaitan | /*
|
---|---|---|---|
2 | * $Id: IzPackMetalTheme.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
|
||
3 | * IzPack
|
||
4 | * Copyright (C) 2001-2004 Julien Ponge
|
||
5 | *
|
||
6 | * File : IzPackMetalTheme.java
|
||
7 | * Description : The metal theme for IzPack.
|
||
8 | * Author's email : julien@izforge.com
|
||
9 | * Author's Website : http://www.izforge.com
|
||
10 | *
|
||
11 | * This program is free software; you can redistribute it and/or
|
||
12 | * modify it under the terms of the GNU General Public License
|
||
13 | * as published by the Free Software Foundation; either version 2
|
||
14 | * of the License, or any later version.
|
||
15 | *
|
||
16 | * This program is distributed in the hope that it will be useful,
|
||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
19 | * GNU General Public License for more details.
|
||
20 | *
|
||
21 | * You should have received a copy of the GNU General Public License
|
||
22 | * along with this program; if not, write to the Free Software
|
||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
24 | */
|
||
25 | package com.izforge.izpack.gui; |
||
26 | |||
27 | import java.awt.Font; |
||
28 | |||
29 | import javax.swing.plaf.ColorUIResource; |
||
30 | import javax.swing.plaf.FontUIResource; |
||
31 | import javax.swing.plaf.metal.DefaultMetalTheme; |
||
32 | |||
33 | /**
|
||
34 | * The IzPack metal theme.
|
||
35 | *
|
||
36 | * @author Julien Ponge
|
||
37 | */
|
||
38 | public class IzPackMetalTheme extends DefaultMetalTheme |
||
39 | { |
||
40 | /** The fonts color. */
|
||
41 | private ColorUIResource color; |
||
42 | |||
43 | private FontUIResource controlFont; |
||
44 | private FontUIResource menuFont; |
||
45 | private FontUIResource windowTitleFont; |
||
46 | |||
47 | /** The constructor. */
|
||
48 | public IzPackMetalTheme()
|
||
49 | { |
||
50 | color = new ColorUIResource(0, 0, 0); |
||
51 | |||
52 | Font font1 = createFont("Tahoma", Font.PLAIN, 11); |
||
53 | Font font2 = createFont("Tahoma", Font.BOLD, 11); |
||
54 | |||
55 | menuFont = new FontUIResource(font1); |
||
56 | controlFont = new FontUIResource(font1); |
||
57 | windowTitleFont = new FontUIResource(font2); |
||
58 | } |
||
59 | |||
60 | private Font createFont(String name, int style, int size) |
||
61 | { |
||
62 | Font font = new Font(name, style, size); |
||
63 | return ((font == null) ? new Font("Dialog", style, size) : font); |
||
64 | } |
||
65 | |||
66 | /**
|
||
67 | * Returns the color.
|
||
68 | *
|
||
69 | * @return The color.
|
||
70 | */
|
||
71 | public ColorUIResource getControlTextColor() |
||
72 | { |
||
73 | return color;
|
||
74 | } |
||
75 | |||
76 | /**
|
||
77 | * Returns the color.
|
||
78 | *
|
||
79 | * @return The color.
|
||
80 | */
|
||
81 | public ColorUIResource getMenuTextColor() |
||
82 | { |
||
83 | return color;
|
||
84 | } |
||
85 | |||
86 | /**
|
||
87 | * Returns the color.
|
||
88 | *
|
||
89 | * @return The color.
|
||
90 | */
|
||
91 | public ColorUIResource getSystemTextColor() |
||
92 | { |
||
93 | return color;
|
||
94 | } |
||
95 | |||
96 | /**
|
||
97 | * Returns the color.
|
||
98 | *
|
||
99 | * @return The color.
|
||
100 | */
|
||
101 | public ColorUIResource getUserTextColor() |
||
102 | { |
||
103 | return color;
|
||
104 | } |
||
105 | |||
106 | /**
|
||
107 | * The Font of Labels in many cases
|
||
108 | */
|
||
109 | public FontUIResource getControlTextFont() |
||
110 | { |
||
111 | return controlFont;
|
||
112 | } |
||
113 | |||
114 | /**
|
||
115 | * The Font of Menus and MenuItems
|
||
116 | */
|
||
117 | public FontUIResource getMenuTextFont() |
||
118 | { |
||
119 | return menuFont;
|
||
120 | } |
||
121 | |||
122 | /**
|
||
123 | * The Font of Nodes in JTrees
|
||
124 | */
|
||
125 | public FontUIResource getSystemTextFont() |
||
126 | { |
||
127 | return controlFont;
|
||
128 | } |
||
129 | |||
130 | /**
|
||
131 | * The Font in TextFields, EditorPanes, etc.
|
||
132 | */
|
||
133 | public FontUIResource getUserTextFont() |
||
134 | { |
||
135 | return controlFont;
|
||
136 | } |
||
137 | |||
138 | /**
|
||
139 | * The Font of the Title of JInternalFrames
|
||
140 | */
|
||
141 | public FontUIResource getWindowTitleFont() |
||
142 | { |
||
143 | return windowTitleFont;
|
||
144 | } |
||
145 | |||
146 | } |