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 | */
|
---|
16 | package org.tp23.antinstaller.renderer.swing.plaf;
|
---|
17 |
|
---|
18 | import java.awt.Font;
|
---|
19 | import java.awt.Insets;
|
---|
20 |
|
---|
21 | import javax.swing.LookAndFeel;
|
---|
22 | import javax.swing.UIDefaults;
|
---|
23 | import javax.swing.UIManager;
|
---|
24 | import 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 | */
|
---|
37 | public 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);
|
---|
100 | table.put("PopupMenu.font", defaultFont);
|
---|
101 | table.put("ProgressBar.font", defaultFont);
|
---|
102 | table.put("RadioButton.font", defaultFont);
|
---|
103 | table.put("RadioButtonMenuItem.font", defaultFont);
|
---|
104 | table.put("TextArea.font", defaultFont);
|
---|
105 | table.put("TextField.font", defaultFont);
|
---|
106 | table.put("TextPane.font", defaultFont);
|
---|
107 | table.put("TabbedPane.font", defaultFont);
|
---|
108 | table.put("ToggleButton.font", defaultFont);
|
---|
109 | table.put("Tree.font", defaultFont);
|
---|
110 | table.put("Viewport.font", defaultFont);
|
---|
111 | table.put("OptionPane.errorIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Error.gif"));
|
---|
112 | table.put("OptionPane.informationIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Inform.gif"));
|
---|
113 | table.put("OptionPane.warningIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Warn.gif"));
|
---|
114 | table.put("Button.margin", new Insets(2,4,2,4));
|
---|
115 | }
|
---|
116 |
|
---|
117 | }
|
---|
118 |
|
---|