001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.swing.plaf;
043:
044: import org.netbeans.swing.plaf.util.GuaranteedValue;
045:
046: import javax.swing.*;
047: import javax.swing.plaf.ColorUIResource;
048: import javax.swing.plaf.FontUIResource;
049: import java.awt.*;
050:
051: /** Customization for all LFs. */
052: final class AllLFCustoms extends LFCustoms {
053:
054: public Object[] createApplicationSpecificKeysAndValues() {
055: //ColorUIResource errorColor = new ColorUIResource(89, 79, 191);
056: // 65358: asked Red color for error messages
057: ColorUIResource errorColor = new ColorUIResource(255, 0, 0);
058: ColorUIResource warningColor = new ColorUIResource(51, 51, 51);
059:
060: Object[] uiDefaults = {
061:
062: ERROR_FOREGROUND,
063: errorColor,
064:
065: WARNING_FOREGROUND,
066: warningColor,
067:
068: //Tab control in case of unknown look and feel
069: TAB_ACTIVE_SELECTION_BACKGROUND,
070: new GuaranteedValue(new String[] {
071: "Table.selectionBackground", "info" },
072: Color.BLUE.brighter()),
073:
074: TAB_ACTIVE_SELECTION_FOREGROUND,
075: new GuaranteedValue("Table.selectionForeground",
076: Color.WHITE),
077:
078: TAB_SELECTION_FOREGROUND,
079: new GuaranteedValue("textText", Color.BLACK),
080:
081: //Likely to be the same for all look and feels - doesn't do anything
082: //exciting
083: EDITOR_TABBED_CONTAINER_UI,
084: "org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI",
085:
086: SLIDING_TAB_DISPLAYER_UI,
087: "org.netbeans.swing.tabcontrol.plaf.BasicSlidingTabDisplayerUI",
088:
089: SLIDING_TAB_BUTTON_UI,
090: "org.netbeans.swing.tabcontrol.plaf.SlidingTabDisplayerButtonUI",
091:
092: SLIDING_BUTTON_UI,
093: "org.netbeans.swing.tabcontrol.SlidingButtonUI", //NOI18N
094:
095: SCROLLPANE_BORDER_COLOR, new Color(127, 157, 185),
096:
097: EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS,
098: new Insets(0, 0, 0, 0), }; //NOI18N
099: return uiDefaults;
100: }
101:
102: public Object[] createGuaranteedKeysAndValues() {
103: int fontsize = 11;
104: Integer in = (Integer) UIManager.get(CUSTOM_FONT_SIZE); //NOI18N
105: boolean hasCustomFontSize = in != null;
106: if (hasCustomFontSize) {
107: fontsize = in.intValue();
108: }
109: Object[] uiDefaults = {
110: //XXX once jdk 1.5 b2 is out, these can be deleted
111:
112: "control",
113: new GuaranteedValue("control", Color.LIGHT_GRAY),
114: "controlShadow",
115: new GuaranteedValue("controlShadow", Color.GRAY),
116: "controlDkShadow",
117: new GuaranteedValue("controlDkShadow", Color.DARK_GRAY),
118: "textText",
119: new GuaranteedValue("textText", Color.BLACK),
120: "controlFont",
121: new GuaranteedValue("controlFont", new Font("Dialog",
122: Font.PLAIN, fontsize)),
123:
124: DEFAULT_FONT_SIZE, new Integer(11), };
125: return uiDefaults;
126: }
127:
128: public static void initCustomFontSize(int uiFontSize) {
129: Font nbDialogPlain = new FontUIResource("Dialog", Font.PLAIN,
130: uiFontSize); // NOI18N
131: Font nbDialogBold = new FontUIResource("Dialog", Font.BOLD,
132: uiFontSize); // NOI18N
133: Font nbSerifPlain = new FontUIResource("Serif", Font.PLAIN,
134: uiFontSize); // NOI18N
135: Font nbSansSerifPlain = new FontUIResource("SansSerif",
136: Font.PLAIN, uiFontSize); // NOI18N
137: Font nbMonospacedPlain = new FontUIResource("Monospaced",
138: Font.PLAIN, uiFontSize); // NOI18N
139: UIManager.put("controlFont", nbDialogPlain); // NOI18N
140: UIManager.put("Button.font", nbDialogPlain); // NOI18N
141: UIManager.put("ToggleButton.font", nbDialogPlain); // NOI18N
142: UIManager.put("RadioButton.font", nbDialogPlain); // NOI18N
143: UIManager.put("CheckBox.font", nbDialogPlain); // NOI18N
144: UIManager.put("ColorChooser.font", nbDialogPlain); // NOI18N
145: UIManager.put("ComboBox.font", nbDialogPlain); // NOI18N
146: UIManager.put("Label.font", nbDialogPlain); // NOI18N
147: UIManager.put("List.font", nbDialogPlain); // NOI18N
148: UIManager.put("FileChooser.listFont", nbDialogPlain); // NOI18N
149: UIManager.put("MenuBar.font", nbDialogPlain); // NOI18N
150: UIManager.put("MenuItem.font", nbDialogPlain); // NOI18N
151: UIManager.put("MenuItem.acceleratorFont", nbDialogPlain); // NOI18N
152: UIManager.put("RadioButtonMenuItem.font", nbDialogPlain); // NOI18N
153: UIManager.put("CheckBoxMenuItem.font", nbDialogPlain); // NOI18N
154: UIManager.put("Menu.font", nbDialogPlain); // NOI18N
155: UIManager.put("PopupMenu.font", nbDialogPlain); // NOI18N
156: UIManager.put("OptionPane.font", nbDialogPlain); // NOI18N
157: UIManager.put("OptionPane.messageFont", nbDialogPlain); // NOI18N
158: UIManager.put("Panel.font", nbDialogPlain); // NOI18N
159: UIManager.put("ProgressBar.font", nbDialogPlain); // NOI18N
160: UIManager.put("ScrollPane.font", nbDialogPlain); // NOI18N
161: UIManager.put("Viewport.font", nbDialogPlain); // NOI18N
162: UIManager.put("TabbedPane.font", nbDialogPlain); // NOI18N
163: UIManager.put("Table.font", nbDialogPlain); // NOI18N
164: UIManager.put("TableHeader.font", nbDialogPlain); // NOI18N
165: UIManager.put("TextField.font", nbSansSerifPlain); // NOI18N
166: UIManager.put("PasswordField.font", nbMonospacedPlain); // NOI18N
167: UIManager.put("TextArea.font", nbDialogPlain); // NOI18N
168: UIManager.put("TextPane.font", nbDialogPlain); // NOI18N
169: UIManager.put("EditorPane.font", nbSerifPlain); // NOI18N
170: UIManager.put("TitledBorder.font", nbDialogPlain); // NOI18N
171: UIManager.put("ToolBar.font", nbDialogPlain); // NOI18N
172: UIManager.put("ToolTip.font", nbSansSerifPlain); // NOI18N
173: UIManager.put("Tree.font", nbDialogPlain); // NOI18N
174: UIManager.put("InternalFrame.titleFont", nbDialogBold); // NOI18N
175: UIManager.put("windowTitleFont", nbDialogBold); // NOI18N
176: }
177:
178: }
|