001: /*
002: * Copyright 2005 Paul Hinds
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.tp23.antinstaller.renderer.swing.plaf;
017:
018: import java.awt.Font;
019: import java.awt.Insets;
020:
021: import javax.swing.LookAndFeel;
022: import javax.swing.UIDefaults;
023: import javax.swing.UIManager;
024: import javax.swing.plaf.metal.MetalLookAndFeel;
025:
026: /**
027: * This LAF is a replacement for Metal for those of us who can't stand the
028: * exsessive use of the <b>BOLD</b> font in the default MetalLookAndFeel
029: * but don't want a heavy LAF that uses excessive memory or increases download
030: * size. The excessive use of Sun's corporate color purple has also been
031: * removed, but icons have been left as they are since they would add
032: * to the download size significantly.
033: * @author Paul Hinds
034: * @version $Id: ModMetalLookAndFeel.java,v 1.3 2006/12/21 00:03:03 teknopaul Exp $
035: */
036: public class ModMetalLookAndFeel extends MetalLookAndFeel {
037:
038: private static final long serialVersionUID = 1L;
039: private static boolean isInstalled = false;
040: protected static final Font defaultFont = new Font("Dialog",
041: Font.PLAIN, 11);
042:
043: public ModMetalLookAndFeel() {
044: if (!isInstalled) {
045: isInstalled = true;
046: UIManager
047: .installLookAndFeel(new javax.swing.UIManager.LookAndFeelInfo(
048: "ModMetal",
049: "org.tp23.laf.modmetal.ModMetalLookAndFeel"));
050: }
051: }
052:
053: public static void setAntiAliased(boolean antialiased) {
054:
055: }
056:
057: public String getID() {
058: return "ModMetalLookAndFeel";
059: }
060:
061: public String getName() {
062: return "ModMetalLookAndFeel";
063: }
064:
065: public String getDescription() {
066: return "Metal LAF with minor changes to default Fonts";
067: }
068:
069: public boolean isNativeLookAndFeel() {
070: return false;
071: }
072:
073: public boolean isSupportedLookAndFeel() {
074: return true;
075: }
076:
077: protected void initClassDefaults(UIDefaults table) {
078: super .initClassDefaults(table);
079: }
080:
081: protected void createDefaultTheme() {
082: setCurrentTheme(new ModMetalTheme());
083: super .createDefaultTheme();
084: }
085:
086: protected void initSystemColorDefaults(UIDefaults table) {
087: super .initSystemColorDefaults(table);
088: }
089:
090: protected void initComponentDefaults(UIDefaults table) {
091: super .initComponentDefaults(table);
092: table.put("Button.font", defaultFont);
093: table.put("Checkbox.font", defaultFont);
094: table.put("CheckboxMenuItem.font", defaultFont);
095: table.put("ComboBox.font", defaultFont);
096: table.put("ComboBox.font", defaultFont);
097: table.put("FormattedTextField.font", defaultFont);
098: table.put("Label.font", defaultFont);
099: table.put("List.font", defaultFont);
100: table.put("Menu.font", defaultFont);
101: table.put("MenuItem.font", defaultFont);
102: table.put("PopupMenu.font", defaultFont);
103: table.put("ProgressBar.font", defaultFont);
104: table.put("RadioButton.font", defaultFont);
105: table.put("RadioButtonMenuItem.font", defaultFont);
106: table.put("TextArea.font", defaultFont);
107: table.put("TextField.font", defaultFont);
108: table.put("TextPane.font", defaultFont);
109: table.put("TabbedPane.font", defaultFont);
110: table.put("ToggleButton.font", defaultFont);
111: table.put("Tree.font", defaultFont);
112: table.put("Viewport.font", defaultFont);
113: table.put("OptionPane.errorIcon", LookAndFeel.makeIcon(
114: MetalLookAndFeel.class, "icons/Error.gif"));
115: table.put("OptionPane.informationIcon", LookAndFeel.makeIcon(
116: MetalLookAndFeel.class, "icons/Inform.gif"));
117: table.put("OptionPane.warningIcon", LookAndFeel.makeIcon(
118: MetalLookAndFeel.class, "icons/Warn.gif"));
119: table.put("Button.margin", new Insets(2, 4, 2, 4));
120: }
121:
122: }
|