KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > swing > plaf > metal > MetalLFCustoms


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.swing.plaf.metal;
21
22 import org.netbeans.swing.plaf.LFCustoms;
23 import org.netbeans.swing.plaf.util.UIBootstrapValue;
24
25 import javax.swing.*;
26 import javax.swing.border.Border JavaDoc;
27 import javax.swing.border.EmptyBorder JavaDoc;
28 import java.awt.*;
29 import org.netbeans.swing.plaf.util.UIUtils;
30
31 /** Default system-provided customizer for Metal LF
32  * Public only to be accessible by ProxyLazyValue, please don't abuse.
33  */

34 public final class MetalLFCustoms extends LFCustoms {
35
36
37
38     public Object JavaDoc[] createLookAndFeelCustomizationKeysAndValues() {
39         int fontsize = 11;
40         Integer JavaDoc in = (Integer JavaDoc) UIManager.get(CUSTOM_FONT_SIZE); //NOI18N
41
if (in != null) {
42             fontsize = in.intValue();
43         }
44         
45         //XXX fetch the custom font size here instead
46
Font controlFont = new Font("Dialog", Font.PLAIN, fontsize); //NOI18N
47
Object JavaDoc[] result = {
48             //The assorted standard NetBeans metal font customizations
49
CONTROLFONT, controlFont,
50             SYSTEMFONT, controlFont,
51             USERFONT, controlFont,
52             MENUFONT, controlFont,
53             WINDOWTITLEFONT, controlFont,
54             LISTFONT, controlFont,
55             TREEFONT, controlFont,
56             PANELFONT, controlFont,
57             SUBFONT, new Font ("Dialog", Font.PLAIN, Math.min(fontsize - 1, 6)),
58             //Bug in JDK 1.5 thru b59 - pale blue is incorrectly returned for this
59
"textInactiveText", Color.GRAY, //NOI18N
60
// #61395
61
SPINNERFONT, controlFont,
62             EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS, new Insets(16, 0, 16, 0),
63         };
64         return result;
65     }
66
67     public Object JavaDoc[] createApplicationSpecificKeysAndValues () {
68         Border JavaDoc outerBorder = BorderFactory.createLineBorder(UIManager.getColor("controlShadow")); //NOI18N
69
Object JavaDoc propertySheetColorings = new MetalPropertySheetColorings();
70         Color unfocusedSelBg = UIManager.getColor("controlShadow");
71         if (!Color.WHITE.equals(unfocusedSelBg.brighter())) { // #57145
72
unfocusedSelBg = unfocusedSelBg.brighter();
73         }
74
75         Object JavaDoc[] result = {
76             DESKTOP_BORDER, new EmptyBorder JavaDoc(1, 1, 1, 1),
77             SCROLLPANE_BORDER, new MetalScrollPaneBorder(),
78             EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP),
79             EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT),
80             EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT),
81             EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT),
82             EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP),
83             EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(),
84
85             PROPERTYSHEET_BOOTSTRAP, propertySheetColorings,
86
87             //UI Delegates for the tab control
88
EDITOR_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.MetalEditorTabDisplayerUI",
89             VIEW_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.MetalViewTabDisplayerUI",
90             SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.MetalSlidingButtonUI",
91
92             EDITOR_TAB_OUTER_BORDER, outerBorder,
93             VIEW_TAB_OUTER_BORDER, outerBorder,
94
95             EXPLORER_MINISTATUSBAR_BORDER, BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("controlShadow")),
96             
97             //#48951 invisible unfocused selection background in Metal L&F
98
"nb.explorer.unfocusedSelBg", unfocusedSelBg,
99                     
100             PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/cancel_task_win_linux_mac.png"),
101                     
102
103             // progress component related
104
// "nbProgressBar.Foreground", new Color(49, 106, 197),
105
// "nbProgressBar.Background", Color.WHITE,
106
"nbProgressBar.popupDynaText.foreground", new Color(115, 115, 115),
107 // "nbProgressBar.popupText.background", new Color(231, 249, 249),
108
"nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"),
109             "nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"),
110             "nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"),
111
112         }; //NOI18N
113
return result;
114     }
115
116     private class MetalPropertySheetColorings extends UIBootstrapValue.Lazy {
117         public MetalPropertySheetColorings () {
118             super (null);
119         }
120
121         public Object JavaDoc[] createKeysAndValues() {
122             return new Object JavaDoc[] {
123                 //Property sheet settings as defined by HIE
124
PROPSHEET_SELECTION_BACKGROUND, new Color(204,204,255),
125                  PROPSHEET_SELECTION_FOREGROUND, Color.BLACK,
126                  PROPSHEET_SET_BACKGROUND, new Color(224,224,224),
127                  PROPSHEET_SET_FOREGROUND, Color.BLACK,
128                  PROPSHEET_SELECTED_SET_BACKGROUND, new Color(204,204,255),
129                  PROPSHEET_SELECTED_SET_FOREGROUND, Color.BLACK,
130                  PROPSHEET_DISABLED_FOREGROUND, new Color(153,153,153),
131             };
132         }
133     }
134
135 }
136
Popular Tags