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.metal;
043:
044: import org.netbeans.swing.plaf.LFCustoms;
045: import org.netbeans.swing.plaf.util.UIBootstrapValue;
046:
047: import javax.swing.*;
048: import javax.swing.border.Border;
049: import javax.swing.border.EmptyBorder;
050: import java.awt.*;
051: import org.netbeans.swing.plaf.util.UIUtils;
052:
053: /** Default system-provided customizer for Metal LF
054: * Public only to be accessible by ProxyLazyValue, please don't abuse.
055: */
056: public final class MetalLFCustoms extends LFCustoms {
057:
058: public Object[] createLookAndFeelCustomizationKeysAndValues() {
059: int fontsize = 11;
060: Integer in = (Integer) UIManager.get(CUSTOM_FONT_SIZE); //NOI18N
061: if (in != null) {
062: fontsize = in.intValue();
063: }
064:
065: //XXX fetch the custom font size here instead
066: Font controlFont = new Font("Dialog", Font.PLAIN, fontsize); //NOI18N
067: Object[] result = {
068: //The assorted standard NetBeans metal font customizations
069: CONTROLFONT,
070: controlFont,
071: SYSTEMFONT,
072: controlFont,
073: USERFONT,
074: controlFont,
075: MENUFONT,
076: controlFont,
077: WINDOWTITLEFONT,
078: controlFont,
079: LISTFONT,
080: controlFont,
081: TREEFONT,
082: controlFont,
083: PANELFONT,
084: controlFont,
085: SUBFONT,
086: new Font("Dialog", Font.PLAIN, Math
087: .min(fontsize - 1, 6)),
088: //Bug in JDK 1.5 thru b59 - pale blue is incorrectly returned for this
089: "textInactiveText",
090: Color.GRAY, //NOI18N
091: // #61395
092: SPINNERFONT, controlFont,
093: EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS,
094: new Insets(16, 0, 16, 0), };
095: return result;
096: }
097:
098: public Object[] createApplicationSpecificKeysAndValues() {
099: Border outerBorder = BorderFactory.createLineBorder(UIManager
100: .getColor("controlShadow")); //NOI18N
101: Object propertySheetColorings = new MetalPropertySheetColorings();
102: Color unfocusedSelBg = UIManager.getColor("controlShadow");
103: if (!Color.WHITE.equals(unfocusedSelBg.brighter())) { // #57145
104: unfocusedSelBg = unfocusedSelBg.brighter();
105: }
106:
107: Object[] result = {
108: DESKTOP_BORDER,
109: new EmptyBorder(1, 1, 1, 1),
110: SCROLLPANE_BORDER,
111: new MetalScrollPaneBorder(),
112: EXPLORER_STATUS_BORDER,
113: new StatusLineBorder(StatusLineBorder.TOP),
114: EDITOR_STATUS_LEFT_BORDER,
115: new StatusLineBorder(StatusLineBorder.TOP
116: | StatusLineBorder.RIGHT),
117: EDITOR_STATUS_RIGHT_BORDER,
118: new StatusLineBorder(StatusLineBorder.TOP
119: | StatusLineBorder.LEFT),
120: EDITOR_STATUS_INNER_BORDER,
121: new StatusLineBorder(StatusLineBorder.TOP
122: | StatusLineBorder.LEFT
123: | StatusLineBorder.RIGHT),
124: EDITOR_STATUS_ONLYONEBORDER,
125: new StatusLineBorder(StatusLineBorder.TOP),
126: EDITOR_TOOLBAR_BORDER,
127: new EditorToolbarBorder(),
128:
129: PROPERTYSHEET_BOOTSTRAP,
130: propertySheetColorings,
131:
132: //UI Delegates for the tab control
133: EDITOR_TAB_DISPLAYER_UI,
134: "org.netbeans.swing.tabcontrol.plaf.MetalEditorTabDisplayerUI",
135: VIEW_TAB_DISPLAYER_UI,
136: "org.netbeans.swing.tabcontrol.plaf.MetalViewTabDisplayerUI",
137: SLIDING_BUTTON_UI,
138: "org.netbeans.swing.tabcontrol.plaf.MetalSlidingButtonUI",
139:
140: EDITOR_TAB_OUTER_BORDER,
141: outerBorder,
142: VIEW_TAB_OUTER_BORDER,
143: outerBorder,
144:
145: EXPLORER_MINISTATUSBAR_BORDER,
146: BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager
147: .getColor("controlShadow")),
148:
149: //#48951 invisible unfocused selection background in Metal L&F
150: "nb.explorer.unfocusedSelBg",
151: unfocusedSelBg,
152:
153: PROGRESS_CANCEL_BUTTON_ICON,
154: UIUtils
155: .loadImage("org/netbeans/swing/plaf/resources/cancel_task_win_linux_mac.png"),
156:
157: // progress component related
158: // "nbProgressBar.Foreground", new Color(49, 106, 197),
159: // "nbProgressBar.Background", Color.WHITE,
160: "nbProgressBar.popupDynaText.foreground",
161: new Color(115, 115, 115),
162: // "nbProgressBar.popupText.background", new Color(231, 249, 249),
163: "nbProgressBar.popupText.foreground",
164: UIManager.getColor("TextField.foreground"),
165: "nbProgressBar.popupText.selectBackground",
166: UIManager.getColor("List.selectionBackground"),
167: "nbProgressBar.popupText.selectForeground",
168: UIManager.getColor("List.selectionForeground"),
169:
170: }; //NOI18N
171:
172: //#108517 - turn off ctrl+page_up and ctrl+page_down mapping
173: return UIUtils
174: .addInputMapsWithoutCtrlPageUpAndCtrlPageDown(result);
175: }
176:
177: private class MetalPropertySheetColorings extends
178: UIBootstrapValue.Lazy {
179: public MetalPropertySheetColorings() {
180: super (null);
181: }
182:
183: public Object[] createKeysAndValues() {
184: return new Object[] {
185: //Property sheet settings as defined by HIE
186: PROPSHEET_SELECTION_BACKGROUND,
187: new Color(204, 204, 255),
188: PROPSHEET_SELECTION_FOREGROUND, Color.BLACK,
189: PROPSHEET_SET_BACKGROUND, new Color(224, 224, 224),
190: PROPSHEET_SET_FOREGROUND, Color.BLACK,
191: PROPSHEET_SELECTED_SET_BACKGROUND,
192: new Color(204, 204, 255),
193: PROPSHEET_SELECTED_SET_FOREGROUND, Color.BLACK,
194: PROPSHEET_DISABLED_FOREGROUND,
195: new Color(153, 153, 153), };
196: }
197: }
198:
199: }
|