1 package org.ozoneDB.adminGui.res; 9 10 import javax.swing.*; 11 import javax.swing.plaf.InsetsUIResource ; 12 import javax.swing.plaf.metal.DefaultMetalTheme ; 13 import java.awt.*; 14 15 18 public class OzoneTheme extends DefaultMetalTheme { 19 20 private static final Color COLOR_COBALT_BLUE = Settings.COLOR_COBALT; 21 private static final Color COLOR_EMERALD = new Color(168, 225, 209); private static final Color SELECTION_COLOR = COLOR_COBALT_BLUE; 23 private static final String FONT_NAME = "SansSerif"; 24 private static final int FONT_SIZE = 11; 25 26 private static final Font FONT_BOLD = new Font(FONT_NAME, Font.BOLD, FONT_SIZE); 27 private static final Font FONT_MENU = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE); 28 private static final Font FONT_FIXED_CONTROL = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE); 29 private static final Font FONT_CONTROL = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE); 30 private static final Font FONT_MESSAGE = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE); 31 private static final Font FONT_WINDOW = new Font(FONT_NAME, Font.BOLD, FONT_SIZE); 32 private static final Font FONT_TOOL_TIP = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE); 33 private static final InsetsUIResource textComponentMargins = new InsetsUIResource (2, 3, 2, 2); 34 35 public String getName() { 36 return "OzoneDB"; 37 } 38 39 public void addCustomEntriesToTable(UIDefaults table) { 40 41 menuSettings(table); 42 fixedControlSettings(table); 43 controlSettings(table); 44 messageSettings(table); 45 windowSettings(table); 46 toolTipSettings(table); 47 scrollBarSettings(table); 48 49 super.addCustomEntriesToTable(table); 50 } 51 52 private void menuSettings(UIDefaults table) { 53 table.put("CheckBoxMenuItem.font", FONT_MENU); 54 table.put("PopupMenu.font", FONT_MENU); 55 table.put("Menu.font", FONT_MENU); 56 table.put("MenuBar.font", FONT_MENU); 57 table.put("MenuItem.font", FONT_MENU); 58 table.put("MenuItem.acceleratorFont", FONT_MENU); 59 table.put("RadioButtonMenuItem.font", FONT_MENU); 60 table.put("ToolBar.font", FONT_MENU); 61 62 table.put("Menu.selectionForeground", Color.WHITE); 63 table.put("MenuItem.selectionForeground", Color.WHITE); 64 table.put("CheckBoxMenuItem.selectionForeground", Color.WHITE); 65 table.put("RadioButtonMenuItem.selectionForeground", Color.WHITE); 66 table.put("Menu.acceleratorSelectionForeground", Color.WHITE); 67 table.put("MenuItem.acceleratorSelectionForeground", Color.WHITE); 68 69 table.put("Menu.acceleratorForeground", Color.BLACK); 70 table.put("MenuItem.acceleratorForeground", Color.BLACK); 71 72 table.put("Menu.selectionBackground", SELECTION_COLOR); 73 table.put("MenuItem.selectionBackground", SELECTION_COLOR); 74 table.put("CheckBoxMenuItem.selectionBackground", SELECTION_COLOR); 75 table.put("RadioButtonMenuItem.selectionBackground", SELECTION_COLOR); 76 } 77 78 private void fixedControlSettings(UIDefaults table) { 79 table.put("PasswordField.font", FONT_FIXED_CONTROL); 80 table.put("Spinner.font", FONT_FIXED_CONTROL); 81 82 table.put("PasswordField.selectionForeground", Color.WHITE); 83 table.put("Spinner.selectionForeground", Color.WHITE); 84 85 table.put("PasswordField.selectionBackground", SELECTION_COLOR); 86 table.put("Spinner.selectionBackground", SELECTION_COLOR); 87 88 table.put("PasswordField.margin", textComponentMargins); 89 table.put("Spinner.margin", textComponentMargins); 90 } 91 92 private void controlSettings(UIDefaults table) { 93 table.put("Button.font", FONT_CONTROL); 94 table.put("CheckBox.font", FONT_CONTROL); 95 table.put("ComboBox.font", FONT_CONTROL); 96 table.put("EditorPane.font", FONT_CONTROL); 97 table.put("QuickLabel.font", FONT_CONTROL); 98 table.put("List.font", FONT_CONTROL); 99 table.put("RadioButton.font", FONT_CONTROL); 100 table.put("Panel.font", FONT_CONTROL); 101 table.put("ProgressBar.font", FONT_CONTROL); 102 table.put("ScrollPane.font", FONT_CONTROL); 103 table.put("TabbedPane.font", FONT_CONTROL); 104 table.put("Table.font", FONT_CONTROL); 105 table.put("TableHeader.font", FONT_CONTROL); 106 table.put("TextArea.font", FONT_FIXED_CONTROL); 107 table.put("TextField.font", FONT_CONTROL); 108 table.put("FormattedTextField.font", FONT_CONTROL); 109 table.put("TextPane.font", FONT_CONTROL); 110 table.put("TitledBorder.font", FONT_CONTROL); 111 table.put("ToggleButton.font", FONT_CONTROL); 112 table.put("Tree.font", FONT_CONTROL); 113 table.put("Viewport.font", FONT_CONTROL); 114 115 table.put("List.selectionForeground", Color.WHITE); 116 table.put("ComboBox.selectionForeground", Color.WHITE); 117 table.put("Table.selectionForeground", Color.WHITE); 118 table.put("TextArea.selectionForeground", Color.WHITE); 119 table.put("TextField.selectionForeground", Color.WHITE); 120 table.put("FormattedTextField.selectionForeground", Color.WHITE); 121 table.put("Tree.selectionForeground", Color.WHITE); 122 123 table.put("List.selectionBackground", SELECTION_COLOR); 124 table.put("ComboBox.selectionBackground", SELECTION_COLOR); 125 table.put("Table.selectionBackground", SELECTION_COLOR); 126 table.put("TextArea.selectionBackground", SELECTION_COLOR); 127 table.put("TextField.selectionBackground", SELECTION_COLOR); 128 table.put("FormattedTextField.selectionBackground", SELECTION_COLOR); 129 table.put("Tree.selectionBackground", SELECTION_COLOR); 130 131 table.put("ComboBox.background", Color.WHITE); 132 table.put("ComboBox.disabledBackground", Color.WHITE); 133 134 table.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1)); 135 136 table.put("TextField.margin", textComponentMargins); 137 table.put("FormattedTextField.margin", textComponentMargins); 138 139 table.put("ProgressBar.foreground", COLOR_COBALT_BLUE); 140 table.put("ProgressBar.background", Color.WHITE); 141 } 142 143 private void messageSettings(UIDefaults table) { 144 table.put("OptionPane.font", FONT_MESSAGE); 145 table.put("OptionPane.messageFont", FONT_MESSAGE); 146 table.put("OptionPane.buttonFont", FONT_MESSAGE); 147 148 table.put("OptionPane.background", Color.WHITE); 149 table.put("OptionPane.foreground", Color.BLACK); 150 table.put("OptionPane.messageForeground", Color.BLACK); 151 } 152 153 private void windowSettings(UIDefaults table) { 154 table.put("InternalFrame.titleFont", FONT_WINDOW); 155 } 156 157 private void toolTipSettings(UIDefaults table) { 158 table.put("ToolTip.font", FONT_TOOL_TIP); 159 table.put("ToolTip.background", COLOR_EMERALD); 160 } 161 162 private void scrollBarSettings(UIDefaults table) { 163 table.put("ScrollBar.background", new Color(230, 230, 230)); 164 table.put("ScrollBar.thumb", COLOR_COBALT_BLUE); 165 } 166 } 167 | Popular Tags |