001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.window.swing;
020:
021: import java.awt.*;
022:
023: import javax.swing.*;
024: import javax.swing.plaf.*;
025: import javax.swing.plaf.metal.*;
026:
027: import org.openharmonise.him.configuration.lnf.*;
028: import org.openharmonise.vfs.gui.IconManager;
029:
030: /**
031: * @author Matthew Large
032: *
033: */
034: public class SimulacraLnF extends DefaultMetalTheme {
035: private final ColorUIResource primary1 = new ColorUIResource(0, 0,
036: 0);
037: private FontUIResource boldFont;
038: private FontUIResource plainFont;
039:
040: public SimulacraLnF() {
041: String fontName = "Dialog";
042: int fontSize = 11;
043: Font font = new Font(fontName, Font.PLAIN, fontSize);
044: plainFont = new FontUIResource(font);
045: font = new Font(fontName, Font.BOLD, fontSize);
046: boldFont = new FontUIResource(font);
047: }
048:
049: public static void setLookAndFeel() {
050: // This is the default.
051: //String lookAndFeelClassName = "javax.swing.plaf.metal.MetalLookAndFeel";
052: UIManager.LookAndFeelInfo[] array = UIManager
053: .getInstalledLookAndFeels();
054: for (int i = 0; i < array.length; i++) {
055: UIManager.LookAndFeelInfo info = array[i];
056: }
057: String lookAndFeelClassName = "com.birosoft.liquid.LiquidLookAndFeel";
058:
059: MetalLookAndFeel.setCurrentTheme(new SimulacraLnF());
060: UIManager.put("Tree.collapsedIcon", IconManager.getInstance()
061: .getIcon("16-tree-collapsed.gif"));
062: UIManager.put("Tree.expandedIcon", IconManager.getInstance()
063: .getIcon("16-tree-expanded.gif"));
064:
065: ToolTipManager.sharedInstance().setInitialDelay(1000);
066: ToolTipManager.sharedInstance().setDismissDelay(2000);
067: ToolTipManager.sharedInstance().setReshowDelay(1500);
068:
069: try {
070: UIManager.setLookAndFeel(lookAndFeelClassName);
071:
072: LookAndFeelConfigOptions config = new LookAndFeelConfigOptions();
073: config.setStoredLnF();
074: } catch (Exception e) {
075: e.printStackTrace();
076: }
077: }
078:
079: public FontUIResource getControlTextFont() {
080: return plainFont;
081: }
082:
083: public FontUIResource getMenuTextFont() {
084: return plainFont;
085: }
086:
087: public FontUIResource getSubTextFont() {
088: return plainFont;
089: }
090:
091: public FontUIResource getSystemTextFont() {
092: return plainFont;
093: }
094:
095: public FontUIResource getUserTextFont() {
096: return plainFont;
097: }
098:
099: public FontUIResource getWindowTitleFont() {
100: return plainFont;
101: }
102:
103: public void addCustomEntriesToTable(UIDefaults table) {
104: table.put("TextField.border", BorderFactory
105: .createLoweredBevelBorder());
106: table.put("SplitPaneUI",
107: "javax.swing.plaf.basic.BasicSplitPaneUI");
108: table.put("ScrollBarUI",
109: "javax.swing.plaf.basic.BasicScrollBarUI");
110: table.put("TreeUI", "javax.swing.plaf.basic.BasicTreeUI");
111: table.put("SplitPane.dividerSize", new Integer(7));
112: table.put("ScrollBar.background", new Color(0xe0e0e0));
113: table.put("ScrollBar.foreground", new Color(0xc0c0c0));
114: table.put("ScrollBar.track", new Color(0xe0e0e0));
115: table.put("ScrollBar.trackHighlight", Color.black);
116: table.put("ScrollBar.thumb", new Color(0xc0c0c0));
117: table.put("ScrollBar.thumbHighlight", Color.white);
118: table.put("ScrollBar.thumbDarkShadow", Color.black);
119: table.put("ScrollBar.thumbLightShadow", new Color(0x808080));
120: table.put("Button.textIconGap", new Integer(2));
121: table.put("Button.font", plainFont);
122: }
123:
124: protected ColorUIResource getPrimary1() {
125: return primary1;
126: }
127:
128: }
|