19 package org.sleuthkit.autopsy.corecomponents;
22 import java.awt.Insets;
24 import java.util.TreeMap;
25 import java.util.logging.Level;
26 import javax.swing.BorderFactory;
27 import javax.swing.ImageIcon;
28 import javax.swing.SwingUtilities;
29 import javax.swing.UIManager;
30 import javax.swing.UIManager.LookAndFeelInfo;
31 import javax.swing.UnsupportedLookAndFeelException;
32 import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI;
33 import org.openide.modules.ModuleInstall;
34 import org.openide.windows.WindowManager;
49 if (null == instance) {
62 SwingUtilities.invokeLater(() -> {
65 UIManager.put(
"ViewTabDisplayerUI",
"org.sleuthkit.autopsy.corecomponents.NoTabsTabDisplayerUI");
66 UIManager.put(DefaultTabbedContainerUI.KEY_VIEW_CONTENT_BORDER, BorderFactory.createEmptyBorder());
67 UIManager.put(
"TabbedPane.contentBorderInsets",
new Insets(0, 0, 0, 0));
68 WindowManager.getDefault().invokeWhenUIReady(() -> {
80 ImageIcon questionIcon =
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/question_32.png"));
81 ImageIcon warningIcon =
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/warning_32.png"));
82 ImageIcon informationIcon =
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/information_32.png"));
83 ImageIcon errorIcon =
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error_32.png"));
84 UIManager.put(
"OptionPane.errorIcon", errorIcon);
85 UIManager.put(
"OptionPane.warningIcon", warningIcon);
86 UIManager.put(
"OptionPane.questionIcon", questionIcon);
87 UIManager.put(
"OptionPane.informationIcon", informationIcon);
89 if (System.getProperty(
"os.name").toLowerCase().contains(
"mac")) {
92 }
else if (System.getProperty(
"os.name").toLowerCase().contains(
"nux")){
104 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
105 }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
106 logger.log(Level.WARNING,
"Error setting OS-X look-and-feel", ex);
111 final String[] UI_MENU_ITEM_KEYS =
new String[]{
"MenuBarUI",};
112 Map<Object, Object> uiEntries =
new TreeMap<>();
113 for (String key : UI_MENU_ITEM_KEYS) {
114 uiEntries.put(key, UIManager.get(key));
118 for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
119 if (
"Nimbus".equals(info.getName())) {
121 UIManager.setLookAndFeel(info.getClassName());
122 }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
123 logger.log(Level.WARNING,
"Error setting OS-X look-and-feel", ex);
130 uiEntries.entrySet().stream().forEach((entry) -> {
131 UIManager.put(entry.getKey(), entry.getValue());
135 private static void setUIFont (javax.swing.plaf.FontUIResource f){
136 java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
137 while (keys.hasMoreElements()) {
138 Object key = keys.nextElement();
139 Object value = UIManager.getDefaults().get(key);
140 if (value instanceof javax.swing.plaf.FontUIResource)
141 UIManager.put(key, f);
156 UIManager.put(
"swing.boldMetal", Boolean.FALSE);
157 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
158 setUIFont (
new javax.swing.plaf.FontUIResource(
"DejaVu Sans Condensed", Font.PLAIN, 11));
160 }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
161 logger.log(Level.WARNING,
"Error setting crossplatform look-and-feel, setting default look-and-feel",ex);
static Installer instance
void setModuleSettings(String value)
static synchronized boolean makeConfigFile(String moduleName)
static final Logger logger
static synchronized Installer getDefault()
void setUnixLookAndFeel()
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
static final long serialVersionUID
static synchronized boolean configExists(String moduleName)
static void setUIFont(javax.swing.plaf.FontUIResource f)
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()