1 /* 
2  * Copyright 2005 Paul Hinds
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.tp23.antinstaller.renderer.swing.plaf;
17
18import java.awt.Font;
19import java.awt.Insets;
20
21import javax.swing.LookAndFeel;
22import javax.swing.UIDefaults;
23import javax.swing.UIManager;
24import javax.swing.plaf.metal.MetalLookAndFeel;
25        
26        
27/**
28 * This LAF is a replacement for Metal for those of us who can't stand the
29 * exsessive use of the <b>BOLD</b> font in the default MetalLookAndFeel
30 * but don't want a heavy LAF that uses excessive memory or increases download
31 * size.  The excessive use of Sun's corporate color purple has also been
32 * removed, but icons have been left as they are since they would add
33 * to the download size significantly.
34 * @author Paul Hinds
35 * @version $Id: ModMetalLookAndFeel.java,v 1.3 2006/12/21 00:03:03 teknopaul Exp $
36 */      
37public class ModMetalLookAndFeel extends MetalLookAndFeel {
38        
39    private static final long serialVersionUID = 1L;
40    private static boolean isInstalled = false;
41    protected static final Font defaultFont = new Font("Dialog",Font.PLAIN,11);
42     
43     
44     public ModMetalLookAndFeel(){
45         if(!isInstalled){
46             isInstalled = true;
47             UIManager.installLookAndFeel(new javax.swing.UIManager.LookAndFeelInfo("ModMetal", "org.tp23.laf.modmetal.ModMetalLookAndFeel"));
48         }
49     }
50     public static void setAntiAliased(boolean antialiased){
51         
52     }
53
54     public String getID(){
55         return "ModMetalLookAndFeel";
56     }
57
58     public String getName()
59     {
60         return "ModMetalLookAndFeel";
61     }
62
63     public String getDescription(){
64         return "Metal LAF with minor changes to default Fonts";
65     }
66
67     public boolean isNativeLookAndFeel(){
68         return false;
69     }
70
71     public boolean isSupportedLookAndFeel(){
72         return true;
73     }
74
75     protected void initClassDefaults(UIDefaults table){
76         super.initClassDefaults(table);
77     }
78
79     protected void createDefaultTheme(){
80         setCurrentTheme(new ModMetalTheme());
81         super.createDefaultTheme();
82     }
83
84     protected void initSystemColorDefaults(UIDefaults table){
85         super.initSystemColorDefaults(table);
86     }
87
88     protected void initComponentDefaults(UIDefaults table){
89         super.initComponentDefaults(table);
90         table.put("Button.font", defaultFont);
91         table.put("Checkbox.font", defaultFont);
92         table.put("CheckboxMenuItem.font", defaultFont);
93         table.put("ComboBox.font", defaultFont);
94         table.put("ComboBox.font", defaultFont);
95         table.put("FormattedTextField.font", defaultFont);
96         table.put("Label.font", defaultFont);
97         table.put("List.font", defaultFont);
98         table.put("Menu.font", defaultFont);
99         table.put("MenuItem.font", defaultFont);
00         table.put("PopupMenu.font", defaultFont);
01         table.put("ProgressBar.font", defaultFont);
02         table.put("RadioButton.font", defaultFont);
03         table.put("RadioButtonMenuItem.font", defaultFont);
04         table.put("TextArea.font", defaultFont);
05         table.put("TextField.font", defaultFont);
06         table.put("TextPane.font", defaultFont);
07         table.put("TabbedPane.font", defaultFont);
08         table.put("ToggleButton.font", defaultFont);
09         table.put("Tree.font", defaultFont);
10         table.put("Viewport.font", defaultFont);
11         table.put("OptionPane.errorIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Error.gif"));
12         table.put("OptionPane.informationIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Inform.gif"));
13         table.put("OptionPane.warningIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Warn.gif"));
14         table.put("Button.margin", new Insets(2,4,2,4));
15     }
16    
17}
18        
19