📄 ozonetheme.java
字号:
// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
//
// $Id: OzoneTheme.java,v 1.1 2003/03/07 13:49:44 per_nyfelt Exp $
package org.ozoneDB.adminGui.res;
import javax.swing.*;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.metal.DefaultMetalTheme;
import java.awt.*;
/**
* @author Per Nyfelt
*/
public class OzoneTheme extends DefaultMetalTheme {
private static final Color COLOR_COBALT_BLUE = Settings.COLOR_COBALT;
private static final Color COLOR_EMERALD = new Color(168, 225, 209); // hex: #A8E1D1
private static final Color SELECTION_COLOR = COLOR_COBALT_BLUE;
private static final String FONT_NAME = "SansSerif";
private static final int FONT_SIZE = 11;
private static final Font FONT_BOLD = new Font(FONT_NAME, Font.BOLD, FONT_SIZE);
private static final Font FONT_MENU = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE);
private static final Font FONT_FIXED_CONTROL = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE);
private static final Font FONT_CONTROL = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE);
private static final Font FONT_MESSAGE = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE);
private static final Font FONT_WINDOW = new Font(FONT_NAME, Font.BOLD, FONT_SIZE);
private static final Font FONT_TOOL_TIP = new Font(FONT_NAME, Font.PLAIN, FONT_SIZE);
private static final InsetsUIResource textComponentMargins = new InsetsUIResource(2, 3, 2, 2);
public String getName() {
return "OzoneDB";
}
public void addCustomEntriesToTable(UIDefaults table) {
menuSettings(table);
fixedControlSettings(table);
controlSettings(table);
messageSettings(table);
windowSettings(table);
toolTipSettings(table);
scrollBarSettings(table);
super.addCustomEntriesToTable(table);
}
private void menuSettings(UIDefaults table) {
table.put("CheckBoxMenuItem.font", FONT_MENU);
table.put("PopupMenu.font", FONT_MENU);
table.put("Menu.font", FONT_MENU);
table.put("MenuBar.font", FONT_MENU);
table.put("MenuItem.font", FONT_MENU);
table.put("MenuItem.acceleratorFont", FONT_MENU);
table.put("RadioButtonMenuItem.font", FONT_MENU);
table.put("ToolBar.font", FONT_MENU);
table.put("Menu.selectionForeground", Color.WHITE);
table.put("MenuItem.selectionForeground", Color.WHITE);
table.put("CheckBoxMenuItem.selectionForeground", Color.WHITE);
table.put("RadioButtonMenuItem.selectionForeground", Color.WHITE);
table.put("Menu.acceleratorSelectionForeground", Color.WHITE);
table.put("MenuItem.acceleratorSelectionForeground", Color.WHITE);
table.put("Menu.acceleratorForeground", Color.BLACK);
table.put("MenuItem.acceleratorForeground", Color.BLACK);
table.put("Menu.selectionBackground", SELECTION_COLOR);
table.put("MenuItem.selectionBackground", SELECTION_COLOR);
table.put("CheckBoxMenuItem.selectionBackground", SELECTION_COLOR);
table.put("RadioButtonMenuItem.selectionBackground", SELECTION_COLOR);
}
private void fixedControlSettings(UIDefaults table) {
table.put("PasswordField.font", FONT_FIXED_CONTROL);
table.put("Spinner.font", FONT_FIXED_CONTROL);
table.put("PasswordField.selectionForeground", Color.WHITE);
table.put("Spinner.selectionForeground", Color.WHITE);
table.put("PasswordField.selectionBackground", SELECTION_COLOR);
table.put("Spinner.selectionBackground", SELECTION_COLOR);
table.put("PasswordField.margin", textComponentMargins);
table.put("Spinner.margin", textComponentMargins);
}
private void controlSettings(UIDefaults table) {
table.put("Button.font", FONT_CONTROL);
table.put("CheckBox.font", FONT_CONTROL);
table.put("ComboBox.font", FONT_CONTROL);
table.put("EditorPane.font", FONT_CONTROL);
table.put("QuickLabel.font", FONT_CONTROL);
table.put("List.font", FONT_CONTROL);
table.put("RadioButton.font", FONT_CONTROL);
table.put("Panel.font", FONT_CONTROL);
table.put("ProgressBar.font", FONT_CONTROL);
table.put("ScrollPane.font", FONT_CONTROL);
table.put("TabbedPane.font", FONT_CONTROL);
table.put("Table.font", FONT_CONTROL);
table.put("TableHeader.font", FONT_CONTROL);
table.put("TextArea.font", FONT_FIXED_CONTROL);
table.put("TextField.font", FONT_CONTROL);
table.put("FormattedTextField.font", FONT_CONTROL);
table.put("TextPane.font", FONT_CONTROL);
table.put("TitledBorder.font", FONT_CONTROL);
table.put("ToggleButton.font", FONT_CONTROL);
table.put("Tree.font", FONT_CONTROL);
table.put("Viewport.font", FONT_CONTROL);
table.put("List.selectionForeground", Color.WHITE);
table.put("ComboBox.selectionForeground", Color.WHITE);
table.put("Table.selectionForeground", Color.WHITE);
table.put("TextArea.selectionForeground", Color.WHITE);
table.put("TextField.selectionForeground", Color.WHITE);
table.put("FormattedTextField.selectionForeground", Color.WHITE);
table.put("Tree.selectionForeground", Color.WHITE);
table.put("List.selectionBackground", SELECTION_COLOR);
table.put("ComboBox.selectionBackground", SELECTION_COLOR);
table.put("Table.selectionBackground", SELECTION_COLOR);
table.put("TextArea.selectionBackground", SELECTION_COLOR);
table.put("TextField.selectionBackground", SELECTION_COLOR);
table.put("FormattedTextField.selectionBackground", SELECTION_COLOR);
table.put("Tree.selectionBackground", SELECTION_COLOR);
table.put("ComboBox.background", Color.WHITE);
table.put("ComboBox.disabledBackground", Color.WHITE);
table.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1));
table.put("TextField.margin", textComponentMargins);
table.put("FormattedTextField.margin", textComponentMargins);
table.put("ProgressBar.foreground", COLOR_COBALT_BLUE);
table.put("ProgressBar.background", Color.WHITE);
}
private void messageSettings(UIDefaults table) {
table.put("OptionPane.font", FONT_MESSAGE);
table.put("OptionPane.messageFont", FONT_MESSAGE);
table.put("OptionPane.buttonFont", FONT_MESSAGE);
table.put("OptionPane.background", Color.WHITE);
table.put("OptionPane.foreground", Color.BLACK);
table.put("OptionPane.messageForeground", Color.BLACK);
}
private void windowSettings(UIDefaults table) {
table.put("InternalFrame.titleFont", FONT_WINDOW);
}
private void toolTipSettings(UIDefaults table) {
table.put("ToolTip.font", FONT_TOOL_TIP);
table.put("ToolTip.background", COLOR_EMERALD);
}
private void scrollBarSettings(UIDefaults table) {
table.put("ScrollBar.background", new Color(230, 230, 230));
table.put("ScrollBar.thumb", COLOR_COBALT_BLUE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -