Search in sources :

Example 1 with WindowsLookAndFeel

use of com.jgoodies.looks.windows.WindowsLookAndFeel in project SIMRacingApps by SIMRacingApps.

the class MainFrame method createInstance.

public static void createInstance() {
    try {
        Toolkit.getDefaultToolkit().setDynamicLayout(true);
        System.setProperty("sun.awt.noerasebackground", "true");
        // JGoodies
        // menu icons
        Options.setDefaultIconSize(new Dimension(16, 16));
        Options.setUseNarrowButtons(false);
        Options.setPopupDropShadowEnabled(true);
        UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows") ? new WindowsLookAndFeel() : new PlasticXPLookAndFeel());
        _instance = new MainFrame();
    } catch (Exception e) {
        System.err.println(e);
    }
}
Also used : PlasticXPLookAndFeel(com.jgoodies.looks.plastic.PlasticXPLookAndFeel) Dimension(java.awt.Dimension) WindowsLookAndFeel(com.jgoodies.looks.windows.WindowsLookAndFeel) ExecException(net.sf.launch4j.ExecException) InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) BuilderException(net.sf.launch4j.BuilderException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) BindingException(net.sf.launch4j.binding.BindingException)

Example 2 with WindowsLookAndFeel

use of com.jgoodies.looks.windows.WindowsLookAndFeel in project beast-mcmc by beast-dev.

the class MainFrame method createInstance.

public static void createInstance() {
    try {
        Toolkit.getDefaultToolkit().setDynamicLayout(true);
        System.setProperty("sun.awt.noerasebackground", "true");
        // JGoodies
        // menu icons
        Options.setDefaultIconSize(new Dimension(16, 16));
        Options.setUseNarrowButtons(false);
        Options.setPopupDropShadowEnabled(true);
        UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows") ? new WindowsLookAndFeel() : new PlasticXPLookAndFeel());
        _instance = new MainFrame();
    } catch (Exception e) {
        System.err.println(e);
    }
}
Also used : PlasticXPLookAndFeel(com.jgoodies.looks.plastic.PlasticXPLookAndFeel) Dimension(java.awt.Dimension) WindowsLookAndFeel(com.jgoodies.looks.windows.WindowsLookAndFeel) ExecException(net.sf.launch4j.ExecException) InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) BuilderException(net.sf.launch4j.BuilderException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) BindingException(net.sf.launch4j.binding.BindingException)

Example 3 with WindowsLookAndFeel

use of com.jgoodies.looks.windows.WindowsLookAndFeel in project UniversalMediaServer by UniversalMediaServer.

the class LooksFrame method initializeLookAndFeel.

public static void initializeLookAndFeel() {
    synchronized (lookAndFeelInitializedLock) {
        if (lookAndFeelInitialized) {
            return;
        }
        LookAndFeel selectedLaf = null;
        if (Platform.isWindows()) {
            selectedLaf = new WindowsLookAndFeel();
        } else if (System.getProperty("nativelook") == null && !Platform.isMac()) {
            selectedLaf = new PlasticLookAndFeel();
        } else {
            try {
                String systemClassName = UIManager.getSystemLookAndFeelClassName();
                // Workaround for Gnome
                try {
                    String gtkLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
                    Class.forName(gtkLAF);
                    if (systemClassName.equals("javax.swing.plaf.metal.MetalLookAndFeel")) {
                        systemClassName = gtkLAF;
                    }
                } catch (ClassNotFoundException ce) {
                    LOGGER.error("Error loading GTK look and feel: ", ce);
                }
                LOGGER.trace("Choosing Java look and feel: " + systemClassName);
                UIManager.setLookAndFeel(systemClassName);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) {
                selectedLaf = new PlasticLookAndFeel();
                LOGGER.error("Error while setting native look and feel: ", e1);
            }
        }
        if (selectedLaf instanceof PlasticLookAndFeel) {
            PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme());
            PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
            PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);
        } else if (selectedLaf != null && selectedLaf.getClass() == MetalLookAndFeel.class) {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        }
        // Work around caching in MetalRadioButtonUI
        JRadioButton radio = new JRadioButton();
        radio.getUI().uninstallUI(radio);
        JCheckBox checkBox = new JCheckBox();
        checkBox.getUI().uninstallUI(checkBox);
        if (selectedLaf != null) {
            try {
                UIManager.setLookAndFeel(selectedLaf);
                // https://bugs.openjdk.java.net/browse/JDK-8179014
                if (selectedLaf instanceof WindowsLookAndFeel) {
                    UIManager.put("FileChooser.useSystemExtensionHiding", false);
                }
            } catch (UnsupportedLookAndFeelException e) {
                LOGGER.warn("Can't change look and feel", e);
            }
        }
        lookAndFeelInitialized = true;
    }
}
Also used : PlasticLookAndFeel(com.jgoodies.looks.plastic.PlasticLookAndFeel) PlasticLookAndFeel(com.jgoodies.looks.plastic.PlasticLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) WindowsLookAndFeel(com.jgoodies.looks.windows.WindowsLookAndFeel) WindowsLookAndFeel(com.jgoodies.looks.windows.WindowsLookAndFeel) DefaultMetalTheme(javax.swing.plaf.metal.DefaultMetalTheme)

Aggregations

WindowsLookAndFeel (com.jgoodies.looks.windows.WindowsLookAndFeel)3 PlasticXPLookAndFeel (com.jgoodies.looks.plastic.PlasticXPLookAndFeel)2 Dimension (java.awt.Dimension)2 BuilderException (net.sf.launch4j.BuilderException)2 ExecException (net.sf.launch4j.ExecException)2 BindingException (net.sf.launch4j.binding.BindingException)2 InvariantViolationException (net.sf.launch4j.binding.InvariantViolationException)2 ConfigPersisterException (net.sf.launch4j.config.ConfigPersisterException)2 PlasticLookAndFeel (com.jgoodies.looks.plastic.PlasticLookAndFeel)1 DefaultMetalTheme (javax.swing.plaf.metal.DefaultMetalTheme)1 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)1