1 19 20 package org.netbeans.swing.plaf.winclassic; 21 22 import java.awt.Color ; 23 import java.awt.Component ; 24 import java.awt.Font ; 25 import java.awt.Graphics ; 26 import java.awt.Insets ; 27 import javax.swing.BorderFactory ; 28 import javax.swing.Icon ; 29 import javax.swing.UIManager ; 30 import javax.swing.border.EmptyBorder ; 31 import org.netbeans.swing.plaf.LFCustoms; 32 import org.netbeans.swing.plaf.util.GuaranteedValue; 33 import org.netbeans.swing.plaf.util.RelativeColor; 34 import org.netbeans.swing.plaf.util.UIBootstrapValue; 35 import org.netbeans.swing.plaf.util.UIUtils; 36 37 40 public final class WindowsLFCustoms extends LFCustoms { 41 42 public Object [] createLookAndFeelCustomizationKeysAndValues() { 43 int fontsize = 11; 44 Integer in = (Integer ) UIManager.get(CUSTOM_FONT_SIZE); if (in != null) { 46 fontsize = in.intValue(); 47 } 48 49 return new Object [] { 50 "EditorPane.selectionBackground", new Color (157, 157, 255), 53 "TextArea.font", new GuaranteedValue("Label.font", new Font ("Dialog", Font.PLAIN, fontsize)), 57 EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS, new Insets (17, 0, 17, 0), 58 }; 59 } 60 61 public Object [] createApplicationSpecificKeysAndValues () { 62 Object propertySheetColorings = new WinClassicPropertySheetColorings(); 63 Object [] result = { 64 DESKTOP_BORDER, new EmptyBorder (4, 2, 1, 2), 65 SCROLLPANE_BORDER, UIManager.get("ScrollPane.border"), 66 EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP), 67 EXPLORER_FOLDER_ICON , UIUtils.loadImage("org/netbeans/swing/plaf/resources/win-explorer-folder.gif"), 68 EXPLORER_FOLDER_OPENED_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/win-explorer-opened-folder.gif"), 69 EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT), 70 EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT), 71 EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT), 72 EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(), 73 EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP), 74 75 PROPERTYSHEET_BOOTSTRAP, propertySheetColorings, 76 77 EDITOR_TAB_CONTENT_BORDER, new WinClassicCompBorder(), 78 EDITOR_TAB_TABS_BORDER, new WinClassicTabBorder(), 79 VIEW_TAB_CONTENT_BORDER, new WinClassicCompBorder(), 80 VIEW_TAB_TABS_BORDER, new WinClassicTabBorder(), 81 82 DESKTOP_SPLITPANE_BORDER, BorderFactory.createEmptyBorder(4, 2, 1, 2), 83 84 EDITOR_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.WinClassicEditorTabDisplayerUI", 86 SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.WindowsSlidingButtonUI", 87 VIEW_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.WinClassicViewTabDisplayerUI", 88 89 PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/cancel_task_win_classic.png"), 90 91 "tab_unsel_fill", UIUtils.adjustColor ( 93 new GuaranteedValue("InternalFrame.inactiveTitleGradient", 94 Color.GRAY).getColor(), 95 -12, -15, -22), 96 97 "tab_sel_fill", new GuaranteedValue("text", Color.WHITE), 98 99 "tab_bottom_border", UIUtils.adjustColor ( 100 new GuaranteedValue("InternalFrame.borderShadow", 101 Color.GRAY).getColor(), 102 20, 17, 12), 103 104 105 "winclassic_tab_sel_gradient", 106 new RelativeColor ( 107 new Color (7, 28, 95), 108 new Color (152, 177, 208), 109 "InternalFrame.activeTitleBackground"), 110 111 "nbProgressBar.Foreground", new Color (49, 106, 197), 113 "nbProgressBar.Background", Color.WHITE, 114 "nbProgressBar.popupDynaText.foreground", new Color (141, 136, 122), 115 "nbProgressBar.popupText.background", new Color (249, 249, 249), 116 "nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"), 117 "nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"), 118 "nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"), 119 }; 121 return result; 122 } 123 124 public Object [] createGuaranteedKeysAndValues() { 125 return new Object [] { 126 "InternalFrame.activeTitleBackground", 127 new GuaranteedValue("InternalFrame.activeTitleBackground", 128 Color.BLUE), 129 130 "InternalFrame.borderShadow", 131 new GuaranteedValue("InternalFrame.borderShadow", Color.gray), 132 133 "InternalFrame.borderHighlight", 134 new GuaranteedValue("InternalFrame.borderHighlight", 135 Color.white), 136 137 "InternalFrame.borderDarkShadow", 138 new GuaranteedValue("InternalFrame.borderDarkShadow", 139 Color.darkGray), 140 141 "InternalFrame.borderLight", 142 new GuaranteedValue("InternalFrame.borderLight", 143 Color.lightGray), 144 145 "TabbedPane.background", 146 new GuaranteedValue("TabbedPane.background", Color.LIGHT_GRAY), 147 148 "TabbedPane.focus", 149 new GuaranteedValue("TabbedPane.focus", Color.GRAY), 150 151 "TabbedPane.highlight", 152 new GuaranteedValue("TabbedPane.highlight", Color.WHITE) , 153 154 "Button.dashedRectGapX", 155 new GuaranteedValue("Button.dashedRectGapX", Integer.valueOf(5)), 156 157 "Button.dashedRectGapY", 158 new GuaranteedValue("Button.dashedRectGapY", Integer.valueOf(4)), 159 160 "Button.dashedRectGapWidth", 161 new GuaranteedValue("Button.dashedRectGapWidth", Integer.valueOf(10)), 162 163 "Button.dashedRectGapHeight", 164 new GuaranteedValue("Button.dashedRectGapHeight", Integer.valueOf(8)), 165 166 "Tree.expandedIcon", new TreeIcon(false), 167 "Tree.collapsedIcon", new TreeIcon(true) 168 }; 169 } 170 171 private static class TreeIcon implements Icon { 172 private static final int HALF_SIZE = 4; 173 private static final int SIZE = 9; 174 175 private boolean collapsed; 176 177 public TreeIcon (boolean collapsed) { 178 this.collapsed = collapsed; 179 } 180 181 public void paintIcon(Component c, Graphics g, int x, int y) { 182 g.setColor(Color.WHITE); 183 g.fillRect(x, y, SIZE-1, SIZE-1); 184 g.setColor(Color.GRAY); 185 g.drawRect(x, y, SIZE-1, SIZE-1); 186 g.setColor(Color.BLACK); 187 g.drawLine(x + 2, y + HALF_SIZE, x + (SIZE - 3), y + HALF_SIZE); 188 if (collapsed) { 189 g.drawLine(x + HALF_SIZE, y + 2, x + HALF_SIZE, y + (SIZE - 3)); 190 } 191 } 192 public int getIconWidth() { return SIZE; } 193 public int getIconHeight() { return SIZE; } 194 } 195 196 protected Object [] additionalKeys() { 197 Object [] kv = new WinClassicPropertySheetColorings().createKeysAndValues(); 198 Object [] result = new Object [kv.length / 2]; 199 int ct = 0; 200 for (int i=0; i < kv.length; i+=2) { 201 result[ct] = kv[i]; 202 ct++; 203 } 204 return result; 205 } 206 207 private class WinClassicPropertySheetColorings extends UIBootstrapValue.Lazy { 208 public WinClassicPropertySheetColorings () { 209 super (null); 210 } 211 212 public Object [] createKeysAndValues() { 213 return new Object [] { 214 PROPSHEET_SELECTION_BACKGROUND, new Color (10,36,106), 216 PROPSHEET_SELECTION_FOREGROUND, Color.WHITE, 217 PROPSHEET_SET_BACKGROUND, new Color (237,233,225), 218 PROPSHEET_SET_FOREGROUND, Color.BLACK, 219 PROPSHEET_SELECTED_SET_BACKGROUND, new Color (10,36,106), 220 PROPSHEET_SELECTED_SET_FOREGROUND, Color.WHITE, 221 PROPSHEET_DISABLED_FOREGROUND, new Color (128,128,128), 222 PROPSHEET_BUTTON_COLOR, UIManager.getColor("control"), 223 }; 224 } 225 } 226 } 227 | Popular Tags |