1 19 20 package org.netbeans.swing.plaf.winvista; 21 22 import java.awt.GraphicsEnvironment ; 23 import java.util.Locale ; 24 import javax.swing.UIManager ; 25 import javax.swing.plaf.ColorUIResource ; 26 import javax.swing.plaf.FontUIResource ; 27 import org.netbeans.swing.plaf.LFCustoms; 28 import org.netbeans.swing.plaf.util.GuaranteedValue; 29 import org.netbeans.swing.plaf.util.UIBootstrapValue; 30 import org.netbeans.swing.plaf.util.UIUtils; 31 32 import javax.swing.*; 33 import javax.swing.border.EmptyBorder ; 34 import javax.swing.border.MatteBorder ; 35 import java.awt.*; 36 37 38 41 public final class VistaLFCustoms extends LFCustoms { 42 private static final String TAB_FOCUS_FILL_UPPER = "tab_focus_fill_upper"; private static final String TAB_FOCUS_FILL_DARK_LOWER = "tab_focus_fill_dark_lower"; private static final String TAB_FOCUS_FILL_BRIGHT_LOWER = "tab_focus_fill_bright_lower"; 46 private static final String TAB_UNSEL_FILL_DARK_UPPER = "tab_unsel_fill_dark_upper"; private static final String TAB_UNSEL_FILL_BRIGHT_UPPER = "tab_unsel_fill_bright_upper"; private static final String TAB_UNSEL_FILL_DARK_LOWER = "tab_unsel_fill_dark_lower"; private static final String TAB_UNSEL_FILL_BRIGHT_LOWER = "tab_unsel_fill_bright_lower"; 51 private static final String TAB_SEL_FILL = "tab_sel_fill"; 53 private static final String TAB_MOUSE_OVER_FILL_BRIGHT_UPPER = "tab_mouse_over_fill_bright_upper"; private static final String TAB_MOUSE_OVER_FILL_DARK_UPPER = "tab_mouse_over_fill_dark_upper"; private static final String TAB_MOUSE_OVER_FILL_BRIGHT_LOWER = "tab_mouse_over_fill_bright_lower"; private static final String TAB_MOUSE_OVER_FILL_DARK_LOWER = "tab_mouse_over_fill_dark_lower"; 58 private static final String TAB_BORDER = "tab_border"; private static final String TAB_SEL_BORDER = "tab_sel_border"; private static final String TAB_BORDER_INNER = "tab_border_inner"; 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 return result; 80 } 81 82 public Object [] createApplicationSpecificKeysAndValues () { 83 UIBootstrapValue editorTabsUI = new VistaEditorColorings ( 84 "org.netbeans.swing.tabcontrol.plaf.WinVistaEditorTabDisplayerUI"); 85 86 Object viewTabsUI = editorTabsUI.createShared("org.netbeans.swing.tabcontrol.plaf.WinVistaViewTabDisplayerUI"); 87 88 Image explorerIcon = UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_folder.png"); 90 91 Object propertySheetValues = new VistaPropertySheetColorings(); 92 93 Object [] uiDefaults = { 94 EDITOR_TAB_DISPLAYER_UI, editorTabsUI, 95 VIEW_TAB_DISPLAYER_UI, viewTabsUI, 96 97 DESKTOP_BACKGROUND, new Color(226, 223, 214), SCROLLPANE_BORDER_COLOR, new Color(127, 157, 185), 99 DESKTOP_BORDER, new EmptyBorder (6, 5, 4, 6), 100 SCROLLPANE_BORDER, UIManager.get("ScrollPane.border"), 101 EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP), 102 EXPLORER_FOLDER_ICON , explorerIcon, 103 EXPLORER_FOLDER_OPENED_ICON, explorerIcon, 104 EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT), 105 EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT), 106 EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT), 107 EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP), 108 EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(), 109 OUTPUT_SELECTION_BACKGROUND, new Color (164, 180, 255), 110 111 PROPERTYSHEET_BOOTSTRAP, propertySheetValues, 112 113 WORKPLACE_FILL, new Color(226, 223, 214), 114 115 DESKTOP_SPLITPANE_BORDER, BorderFactory.createEmptyBorder(4, 0, 0, 0), 116 SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.WinVistaSlidingButtonUI", 117 118 "nbProgressBar.Foreground", new Color(49, 106, 197), 120 "nbProgressBar.Background", Color.WHITE, 121 "nbProgressBar.popupDynaText.foreground", new Color(115, 115, 115), 122 "nbProgressBar.popupText.background", new Color(249, 249, 249), 123 "nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"), 124 "nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"), 125 "nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"), 126 PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_enabled.png"), 127 PROGRESS_CANCEL_BUTTON_ROLLOVER_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_over.png"), 128 PROGRESS_CANCEL_BUTTON_PRESSED_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_pressed.png") 129 130 }; 132 convert ("TextField.background"); convert ("TextField.inactiveBackground"); convert ("TextField.disabledBackground"); 138 return uiDefaults; 139 } 140 141 145 private static final void convert (String key) { 146 Color c = UIManager.getColor(key); 147 if (c != null && !(c instanceof ColorUIResource )) { 148 UIManager.put (key, new ColorUIResource (c)); 149 } 150 } 151 152 protected Object [] additionalKeys() { 153 Object [] kv = new VistaEditorColorings("").createKeysAndValues(); 154 Object [] kv2 = new VistaPropertySheetColorings().createKeysAndValues(); 155 Object [] result = new Object [(kv.length / 2) + (kv2.length / 2)]; 156 int ct = 0; 157 for (int i=0; i < kv.length; i+=2) { 158 result[ct] = kv[i]; 159 ct++; 160 } 161 for (int i=0; i < kv2.length; i+=2) { 162 result[ct] = kv2[i]; 163 ct++; 164 } 165 return result; 166 } 167 168 private class VistaEditorColorings extends UIBootstrapValue.Lazy { 169 public VistaEditorColorings (String name) { 170 super (name); 171 } 172 173 public Object [] createKeysAndValues() { 174 return new Object [] { 175 TAB_FOCUS_FILL_UPPER, new Color(242, 249, 252), 179 TAB_FOCUS_FILL_BRIGHT_LOWER, new Color(225, 241, 249), 180 TAB_FOCUS_FILL_DARK_LOWER, new Color(216, 236, 246), 181 182 TAB_UNSEL_FILL_BRIGHT_UPPER, new Color(235,235,235), 184 TAB_UNSEL_FILL_DARK_UPPER, new Color(229, 229, 229), 185 TAB_UNSEL_FILL_BRIGHT_LOWER, new Color(214,214,214), 186 TAB_UNSEL_FILL_DARK_LOWER, new Color(203, 203, 203), 187 188 TAB_SEL_FILL, new Color(244,244,244), 190 191 TAB_MOUSE_OVER_FILL_BRIGHT_UPPER, new Color(223,242,252), 193 TAB_MOUSE_OVER_FILL_DARK_UPPER, new Color(214,239,252), 194 TAB_MOUSE_OVER_FILL_BRIGHT_LOWER, new Color(189,228,250), 195 TAB_MOUSE_OVER_FILL_DARK_LOWER, new Color(171,221,248), 196 197 TAB_BORDER, new Color(137,140,149), 198 TAB_SEL_BORDER, new Color(60,127,177), 199 TAB_BORDER_INNER, new Color(255,255,255), 200 201 EDITOR_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), 203 EDITOR_TAB_CONTENT_BORDER, 204 new MatteBorder (0, 1, 1, 1, new Color(137, 140, 149)), 205 EDITOR_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), 206 207 VIEW_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), 208 VIEW_TAB_CONTENT_BORDER, 209 new MatteBorder (0, 1, 1, 1, new Color(137, 140, 149)), 210 VIEW_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), 211 }; 212 } 213 } 214 215 private class VistaPropertySheetColorings extends UIBootstrapValue.Lazy { 216 public VistaPropertySheetColorings () { 217 super ("propertySheet"); } 219 220 public Object [] createKeysAndValues() { 221 return new Object [] { 222 PROPSHEET_SELECTION_BACKGROUND, new Color(49,106,197), 223 PROPSHEET_SELECTION_FOREGROUND, Color.WHITE, 224 PROPSHEET_SET_BACKGROUND, new Color(213,213,213), 225 PROPSHEET_SET_FOREGROUND, Color.BLACK, 226 PROPSHEET_SELECTED_SET_BACKGROUND, new Color(49,106,197), 227 PROPSHEET_SELECTED_SET_FOREGROUND, Color.WHITE, 228 PROPSHEET_DISABLED_FOREGROUND, new Color(161,161,146), 229 PROPSHEET_BUTTON_FOREGROUND, Color.BLACK, 230 }; 231 } 232 } 233 } 234 | Popular Tags |