KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > swing > plaf > AllLFCustoms


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;
21
22 import org.netbeans.swing.plaf.util.GuaranteedValue;
23 import org.netbeans.swing.plaf.util.RelativeColor;
24 import org.netbeans.swing.plaf.util.UIUtils;
25
26 import javax.swing.*;
27 import javax.swing.plaf.ColorUIResource JavaDoc;
28 import javax.swing.plaf.FontUIResource JavaDoc;
29 import java.awt.*;
30
31 /** Customization for all LFs. */
32 final class AllLFCustoms extends LFCustoms {
33
34     public Object JavaDoc[] createApplicationSpecificKeysAndValues () {
35         //ColorUIResource errorColor = new ColorUIResource(89, 79, 191);
36
// 65358: asked Red color for error messages
37
ColorUIResource JavaDoc errorColor = new ColorUIResource JavaDoc (255, 0, 0);
38         ColorUIResource JavaDoc warningColor = new ColorUIResource JavaDoc(51, 51, 51);
39         
40         Object JavaDoc[] uiDefaults = {
41
42             ERROR_FOREGROUND, errorColor,
43
44             WARNING_FOREGROUND, warningColor,
45
46             //Tab control in case of unknown look and feel
47
TAB_ACTIVE_SELECTION_BACKGROUND,
48                 new GuaranteedValue (new String JavaDoc[] {"Table.selectionBackground",
49                 "info"}, Color.BLUE.brighter()),
50
51             TAB_ACTIVE_SELECTION_FOREGROUND,
52                 new GuaranteedValue ("Table.selectionForeground",
53                 Color.WHITE),
54
55             TAB_SELECTION_FOREGROUND,
56                 new GuaranteedValue("textText", Color.BLACK),
57
58             //Likely to be the same for all look and feels - doesn't do anything
59
//exciting
60
EDITOR_TABBED_CONTAINER_UI,
61                 "org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI",
62
63             SLIDING_TAB_DISPLAYER_UI,
64                 "org.netbeans.swing.tabcontrol.plaf.BasicSlidingTabDisplayerUI",
65             
66             SLIDING_TAB_BUTTON_UI,
67                 "org.netbeans.swing.tabcontrol.plaf.SlidingTabDisplayerButtonUI",
68
69             SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.SlidingButtonUI", //NOI18N
70

71         
72             SCROLLPANE_BORDER_COLOR, new Color(127, 157, 185),
73                         
74             EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS, new Insets(0, 0, 0, 0),
75         }; //NOI18N
76
return uiDefaults;
77     }
78
79     public Object JavaDoc[] createGuaranteedKeysAndValues () {
80         int fontsize = 11;
81         Integer JavaDoc in = (Integer JavaDoc) UIManager.get(CUSTOM_FONT_SIZE); //NOI18N
82
boolean hasCustomFontSize = in != null;
83         if (hasCustomFontSize) {
84             fontsize = in.intValue();
85         }
86         Object JavaDoc[] uiDefaults = {
87             //XXX once jdk 1.5 b2 is out, these can be deleted
88

89             "control", new GuaranteedValue ("control", Color.LIGHT_GRAY),
90             "controlShadow", new GuaranteedValue ("controlShadow", Color.GRAY),
91             "controlDkShadow", new GuaranteedValue ("controlDkShadow", Color.DARK_GRAY),
92             "textText", new GuaranteedValue ("textText", Color.BLACK),
93             "controlFont", new GuaranteedValue ("controlFont",
94                 new Font ("Dialog", Font.PLAIN, fontsize)),
95             
96             DEFAULT_FONT_SIZE, new Integer JavaDoc(11),
97         };
98         return uiDefaults;
99     }
100
101     public static void initCustomFontSize (int uiFontSize) {
102         Font nbDialogPlain = new FontUIResource JavaDoc("Dialog", Font.PLAIN, uiFontSize); // NOI18N
103
Font nbDialogBold = new FontUIResource JavaDoc("Dialog", Font.BOLD, uiFontSize); // NOI18N
104
Font nbSerifPlain = new FontUIResource JavaDoc("Serif", Font.PLAIN, uiFontSize); // NOI18N
105
Font nbSansSerifPlain = new FontUIResource JavaDoc("SansSerif", Font.PLAIN, uiFontSize); // NOI18N
106
Font nbMonospacedPlain = new FontUIResource JavaDoc("Monospaced", Font.PLAIN, uiFontSize); // NOI18N
107
UIManager.put("controlFont", nbDialogPlain); // NOI18N
108
UIManager.put("Button.font", nbDialogPlain); // NOI18N
109
UIManager.put("ToggleButton.font", nbDialogPlain); // NOI18N
110
UIManager.put("RadioButton.font", nbDialogPlain); // NOI18N
111
UIManager.put("CheckBox.font", nbDialogPlain); // NOI18N
112
UIManager.put("ColorChooser.font", nbDialogPlain); // NOI18N
113
UIManager.put("ComboBox.font", nbDialogPlain); // NOI18N
114
UIManager.put("Label.font", nbDialogPlain); // NOI18N
115
UIManager.put("List.font", nbDialogPlain); // NOI18N
116
UIManager.put("MenuBar.font", nbDialogPlain); // NOI18N
117
UIManager.put("MenuItem.font", nbDialogPlain); // NOI18N
118
UIManager.put("MenuItem.acceleratorFont", nbDialogPlain); // NOI18N
119
UIManager.put("RadioButtonMenuItem.font", nbDialogPlain); // NOI18N
120
UIManager.put("CheckBoxMenuItem.font", nbDialogPlain); // NOI18N
121
UIManager.put("Menu.font", nbDialogPlain); // NOI18N
122
UIManager.put("PopupMenu.font", nbDialogPlain); // NOI18N
123
UIManager.put("OptionPane.font", nbDialogPlain); // NOI18N
124
UIManager.put("OptionPane.messageFont", nbDialogPlain); // NOI18N
125
UIManager.put("Panel.font", nbDialogPlain); // NOI18N
126
UIManager.put("ProgressBar.font", nbDialogPlain); // NOI18N
127
UIManager.put("ScrollPane.font", nbDialogPlain); // NOI18N
128
UIManager.put("Viewport.font", nbDialogPlain); // NOI18N
129
UIManager.put("TabbedPane.font", nbDialogPlain); // NOI18N
130
UIManager.put("Table.font", nbDialogPlain); // NOI18N
131
UIManager.put("TableHeader.font", nbDialogPlain); // NOI18N
132
UIManager.put("TextField.font", nbSansSerifPlain); // NOI18N
133
UIManager.put("PasswordField.font", nbMonospacedPlain); // NOI18N
134
UIManager.put("TextArea.font", nbDialogPlain); // NOI18N
135
UIManager.put("TextPane.font", nbDialogPlain); // NOI18N
136
UIManager.put("EditorPane.font", nbSerifPlain); // NOI18N
137
UIManager.put("TitledBorder.font", nbDialogPlain); // NOI18N
138
UIManager.put("ToolBar.font", nbDialogPlain); // NOI18N
139
UIManager.put("ToolTip.font", nbSansSerifPlain); // NOI18N
140
UIManager.put("Tree.font", nbDialogPlain); // NOI18N
141
UIManager.put("InternalFrame.titleFont", nbDialogBold); // NOI18N
142
UIManager.put("windowTitleFont", nbDialogBold); // NOI18N
143
}
144
145
146 }
147
Popular Tags