1 19 20 package org.netbeans.swing.plaf.winxp; 21 22 import javax.swing.UIManager ; 23 import javax.swing.plaf.ColorUIResource ; 24 import org.netbeans.swing.plaf.LFCustoms; 25 import org.netbeans.swing.plaf.util.GuaranteedValue; 26 import org.netbeans.swing.plaf.util.UIBootstrapValue; 27 import org.netbeans.swing.plaf.util.UIUtils; 28 29 import javax.swing.*; 30 import javax.swing.border.EmptyBorder ; 31 import javax.swing.border.MatteBorder ; 32 import java.awt.*; 33 import java.util.logging.Level ; 34 import java.util.logging.Logger ; 35 import java.util.ResourceBundle ; 36 37 38 41 public final class XPLFCustoms extends LFCustoms { 42 private static final String TAB_FOCUS_FILL_DARK = "tab_focus_fill_dark"; private static final String TAB_FOCUS_FILL_BRIGHT = "tab_focus_fill_bright"; private static final String TAB_UNSEL_FILL_DARK = "tab_unsel_fill_dark"; private static final String TAB_UNSEL_FILL_BRIGHT = "tab_unsel_fill_bright"; private static final String TAB_SEL_FILL = "tab_sel_fill"; private static final String TAB_SEL_FILL_BRIGHT = "tab_sel_fill_bright"; private static final String TAB_SEL_FILL_DARK = "tab_sel_fill_dark"; private static final String TAB_BORDER = "tab_border"; private static final String TAB_BOTTOM_BORDER = "tab_bottom_border"; private static final String TAB_SEL_BORDER = "tab_sel_border"; private static final String TAB_HIGHLIGHT_HEADER = "tab_highlight_header"; private static final String TAB_HIGHLIGHT_HEADER_FILL = "tab_highlight_header_fill"; private static final String STANDARD_BORDER = "standard_border"; private static final String TAB_CLOSE_BUTTON = "close_button"; private static final String TAB_CLOSE_BUTTON_HIGHLIGHT = "close_button_highlight"; private static final String TAB_CLOSE_BUTTON_BORDER_FOCUS = "close_button_border_focus"; private static final String TAB_CLOSE_BUTTON_BORDER_SELECTED = "close_button_border_selected"; private static final String TAB_CLOSE_BUTTON_BORDER_UNSEL = "close_button_border_unsel"; private static final String TAB_SEL_BOTTOM_BORDER = "tab_sel_bottom_border"; 62 static final String SCROLLPANE_BORDER_COLOR = "scrollpane_border"; 64 public Object [] createLookAndFeelCustomizationKeysAndValues() { 65 int fontsize = 11; 66 Integer in = (Integer ) UIManager.get(CUSTOM_FONT_SIZE); if (in != null) { 68 fontsize = in.intValue(); 69 } 70 71 Object [] result = new Object [] { 72 "TextArea.font", new GuaranteedValue ("Label.font", new Font("Dialog", Font.PLAIN, fontsize)), 75 76 EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS, new Insets(17, 0, 17, 0), 77 }; 78 79 tahomaWarning(); 80 81 return result; 82 } 83 84 public Object [] createApplicationSpecificKeysAndValues () { 85 UIBootstrapValue editorTabsUI = new XPEditorColorings ( 86 "org.netbeans.swing.tabcontrol.plaf.WinXPEditorTabDisplayerUI"); 87 88 Object viewTabsUI = editorTabsUI.createShared("org.netbeans.swing.tabcontrol.plaf.WinXPViewTabDisplayerUI"); 89 90 Image explorerIcon = UIUtils.loadImage("org/netbeans/swing/plaf/resources/xp-explorer-folder.gif"); 91 92 Object propertySheetValues = new XPPropertySheetColorings(); 93 94 Object [] uiDefaults = { 95 EDITOR_TAB_DISPLAYER_UI, editorTabsUI, 96 VIEW_TAB_DISPLAYER_UI, viewTabsUI, 97 98 DESKTOP_BACKGROUND, new Color(226, 223, 214), SCROLLPANE_BORDER_COLOR, new Color(127, 157, 185), 100 DESKTOP_BORDER, new EmptyBorder (6, 5, 4, 6), 101 SCROLLPANE_BORDER, UIManager.get("ScrollPane.border"), 102 EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP), 103 EXPLORER_FOLDER_ICON , explorerIcon, 104 EXPLORER_FOLDER_OPENED_ICON, explorerIcon, 105 EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT), 106 EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT), 107 EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT), 108 EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP), 109 EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(), 110 OUTPUT_SELECTION_BACKGROUND, new Color (164, 180, 255), 111 112 PROPERTYSHEET_BOOTSTRAP, propertySheetValues, 113 114 WORKPLACE_FILL, new Color(226, 223, 214), 115 116 DESKTOP_SPLITPANE_BORDER, BorderFactory.createEmptyBorder(4, 0, 0, 0), 117 SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.WinXPSlidingButtonUI", 118 119 "nbProgressBar.Foreground", new Color(49, 106, 197), 121 "nbProgressBar.Background", Color.WHITE, 122 "nbProgressBar.popupDynaText.foreground", new Color(141, 136, 122), 123 "nbProgressBar.popupText.background", new Color(249, 249, 249), 124 "nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"), 125 "nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"), 126 "nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"), 127 PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/cancel_task_win_xp.png") 128 129 }; 131 convert ("TextField.background"); convert ("TextField.inactiveBackground"); convert ("TextField.disabledBackground"); 137 return uiDefaults; 138 } 139 140 144 private static final void convert (String key) { 145 Color c = UIManager.getColor(key); 146 if (c != null && !(c instanceof ColorUIResource )) { 147 UIManager.put (key, new ColorUIResource (c)); 148 } 149 } 150 151 protected Object [] additionalKeys() { 152 Object [] kv = new XPEditorColorings("").createKeysAndValues(); 153 Object [] kv2 = new XPPropertySheetColorings().createKeysAndValues(); 154 Object [] result = new Object [(kv.length / 2) + (kv2.length / 2)]; 155 int ct = 0; 156 for (int i=0; i < kv.length; i+=2) { 157 result[ct] = kv[i]; 158 ct++; 159 } 160 for (int i=0; i < kv2.length; i+=2) { 161 result[ct] = kv2[i]; 162 ct++; 163 } 164 return result; 165 } 166 167 170 private void tahomaWarning () { 171 String version = System.getProperty("java.version"); 172 if ("1.5.0".equals(version) || version.startsWith("1.5.0_01")) { 173 Logger.getLogger(XPLFCustoms.class.getName()).log(Level.WARNING, 174 ResourceBundle.getBundle("org.netbeans.swing.plaf.winxp.Bundle").getString("MSG_TahomaWarning")); 175 } 176 } 177 178 179 private class XPEditorColorings extends UIBootstrapValue.Lazy { 180 public XPEditorColorings (String name) { 181 super (name); 182 } 183 184 public Object [] createKeysAndValues() { 185 return new Object [] { 186 TAB_FOCUS_FILL_DARK, new Color(210, 220, 243), 189 TAB_FOCUS_FILL_BRIGHT, new Color(238, 242, 253), 190 TAB_UNSEL_FILL_DARK, new Color(236, 235, 229), 191 TAB_UNSEL_FILL_BRIGHT, new Color(252,251,246), 192 TAB_SEL_FILL, Color.white, 193 TAB_SEL_FILL_BRIGHT, Color.white, 194 TAB_SEL_FILL_DARK, new Color(243, 241, 224), 195 TAB_BORDER, new Color(145, 167, 180), 196 TAB_BOTTOM_BORDER, new Color(127, 157, 185), 197 TAB_SEL_BORDER, new Color(145, 155, 156), 198 TAB_HIGHLIGHT_HEADER, new Color(230, 139, 44), 199 TAB_HIGHLIGHT_HEADER_FILL, new Color(255, 199, 60), 200 STANDARD_BORDER, new Color(127, 157, 185), 201 TAB_CLOSE_BUTTON, Color.black, 202 TAB_CLOSE_BUTTON_HIGHLIGHT, new Color(172,57,28), 203 TAB_CLOSE_BUTTON_BORDER_FOCUS, new Color(181,201,243), 204 TAB_CLOSE_BUTTON_BORDER_SELECTED, new Color(203,202,187), 205 TAB_CLOSE_BUTTON_BORDER_UNSEL, new Color(200,201,192), 206 TAB_SEL_BOTTOM_BORDER, new Color(238,235,218), 207 208 EDITOR_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), 210 EDITOR_TAB_CONTENT_BORDER, 211 new MatteBorder (0, 1, 1, 1, new Color(127, 157, 185)), 212 EDITOR_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), 213 214 VIEW_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), 215 VIEW_TAB_CONTENT_BORDER, 216 new MatteBorder (0, 1, 1, 1, new Color(127, 157, 185)), 217 VIEW_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), 218 }; 219 } 220 } 221 222 private class XPPropertySheetColorings extends UIBootstrapValue.Lazy { 223 public XPPropertySheetColorings () { 224 super ("propertySheet"); } 226 227 public Object [] createKeysAndValues() { 228 return new Object [] { 229 PROPSHEET_SET_BACKGROUND, new Color(49,106,197), 230 PROPSHEET_SELECTION_FOREGROUND, Color.WHITE, 231 PROPSHEET_SET_BACKGROUND, new Color(212,208,200), 232 PROPSHEET_SET_FOREGROUND, Color.BLACK, 233 PROPSHEET_SELECTED_SET_BACKGROUND, new Color(49,106,197), 234 PROPSHEET_SELECTED_SET_FOREGROUND, Color.WHITE, 235 PROPSHEET_DISABLED_FOREGROUND, new Color(161,161,146), 236 PROPSHEET_BUTTON_FOREGROUND, Color.BLACK, 237 }; 238 } 239 240 } 241 } 242 | Popular Tags |