Example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setHighContrastFocusColorsEnabled

List of usage examples for com.jgoodies.looks.plastic PlasticLookAndFeel setHighContrastFocusColorsEnabled

Introduction

In this page you can find the example usage for com.jgoodies.looks.plastic PlasticLookAndFeel setHighContrastFocusColorsEnabled.

Prototype

public static void setHighContrastFocusColorsEnabled(boolean b) 

Source Link

Usage

From source file:ch.fork.AdHocRailway.ui.AdHocRailway.java

License:Open Source License

public AdHocRailway(org.apache.commons.cli.CommandLine parsedCommandLine) {
    super(TITLE);
    try {//from   w  w w. ja  v  a  2  s .c o m

        appContext = new ApplicationContext();
        appContext.getMainBus().register(appContext);
        appContext.getMainBus().register(this);
        appContext.setMainApp(this);
        appContext.setMainFrame(this);
        setUpLogging();

        LOGGER.info("****************************************");
        LOGGER.info("AdHoc-Railway starting up!!!");
        LOGGER.info("****************************************");

        PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);

        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());

        splash = new SplashWindow(createImageIconFromCustom("splash.png"), this, 500, 12);
        setIconImage(createImageIconFromCustom("2-Hot-Train-icon 128.png").getImage());

        initProceeded("Loading Persistence Layer (Preferences)");

        preferences = Preferences.getInstance();
        preferences.loadPreferences(parsedCommandLine.hasOption("c"));
        appContext.setPreferences(preferences);

        railwayDeviceManager = new RailwayDeviceManager(appContext);
        appContext.setRailwayDeviceManager(railwayDeviceManager);
        railwayDeviceManager.loadControlLayer();

        persistenceManager = new PersistenceManager(appContext);
        persistenceManager.loadPersistenceLayer();

        initProceeded("Creating GUI ...");

        initGUI();
        disableEnableMenuItems();
        LOGGER.info("Finished Creating GUI");
        splash.setVisible(false);

        persistenceManager.loadLastFileOrLoadDataFromAdHocServerIfRequested();

        updateGUI();
        railwayDeviceManager.autoConnectToRailwayDeviceIfRequested();

        setSize(1600, 1000);

        initProceeded("AdHoc-Railway started");
        updateCommandHistory("AdHoc-Railway started");
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(final Thread t, final Throwable e) {
                handleException(e);
            }
        });
        setLocationByPlatform(true);
        setVisible(true);
    } catch (final Exception e) {
        handleException(e);
    }
}

From source file:de.xplib.xdbm.ui.Application.java

License:Open Source License

/**
 * Sets global user interface options.//w w w.  ja v a2  s. co m
 */
private void configureUI() {

    Options.setDefaultIconSize(new Dimension(18, 18));

    // Set font options      
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts());
    Options.setGlobalFontSizeHints(settings.getFontSizeHints());
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());
    Options.setPopupDropShadowEnabled(settings.isPopupDropShadowEnabled().booleanValue());

    // Global options
    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    // Swing Settings
    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled());
    } else if (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);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        System.out.println("Can't change L&F: " + e);
    }
}

From source file:etomica.virial.cluster2.mvc.view.ApplicationUI.java

License:Mozilla Public License

/**
 * Configures the user interface; requests Swing settings and JGoodies Looks options
 * from the launcher./*from  w  ww .  jav  a 2  s. c  o m*/
 */
public static void configure() {

    // UIManager.put("ToolTip.hideAccelerator", Boolean.FALSE);
    Options.setDefaultIconSize(DF_ICON_SIZE);
    Options.setUseNarrowButtons(uiSettings.isUseNarrowButtons());
    // Global options
    Options.setTabIconsEnabled(uiSettings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, uiSettings.isPopupDropShadowEnabled());
    // Swing Settings
    LookAndFeel selectedLaf = uiSettings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setPlasticTheme(uiSettings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(uiSettings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(uiSettings.isPlasticHighContrastFocusEnabled());
    } else if (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);
    // try setting the look and feel
    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        System.out.println("Can't change the look and feel: " + e);
    }
}

From source file:net.dpml.depot.desktop.Desktop.java

License:Apache License

/**
 * Configures the UI; tries to set the system look on Mac, 
 * WindowsLookAndFeel on general Windows, and
 * Plastic3DLookAndFeel on Windows XP and all other OS.
 *//*from  w  w  w.j a va 2s .c om*/
private void configureUI() {
    Options.setDefaultIconSize(new Dimension(18, 18));

    // Set font options      
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts());
    Options.setGlobalFontSizeHints(settings.getFontSizeHints());
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());

    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    // MetalRadioButtonUI caching work around
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.pms.newgui.LooksFrame.java

License:Open Source License

static void initializeLookAndFeel() {
    if (lookAndFeelInitialized) {
        return;//from  w  w  w  . j  av a 2  s .c o  m
    }

    LookAndFeel selectedLaf = null;
    if (Platform.isWindows()) {
        try {
            selectedLaf = (LookAndFeel) Class.forName("com.jgoodies.looks.windows.WindowsLookAndFeel")
                    .newInstance();
        } catch (Exception e) {
            selectedLaf = new PlasticLookAndFeel();
        }
    } 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 (Exception 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);
        } catch (UnsupportedLookAndFeelException e) {
            logger.warn("Can't change look and feel", e);
        }
    }

    lookAndFeelInitialized = true;
}

From source file:org.qedeq.gui.se.util.GuiHelper.java

License:Open Source License

/**
 * Configures the user interface; requests Swing settings and JGoodies Looks
 * options from the launcher.//from  w  ww .  j  a v  a2  s.c  o m
 *
 * @param   options Set these options.
 */
public static void configureUI(final GuiOptions options) {
    UIManager.put("ClassLoader", CLASS.getClassLoader());

    Options.setDefaultIconSize(new Dimension(18, 18));
    Options.setUseNarrowButtons(options.isUseNarrowButtons());
    Options.setTabIconsEnabled(options.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, options.isPopupDropShadowEnabled());
    // LATER m31 20100319: we make this now direct in QedeqPane, this line
    // didn't help. Why?
    // we want our disabled TextAreas to look same if not editable
    UIManager.put("TextArea.disabledBackground", UIManager.get("TextArea.background"));

    UIManager.put("ToolTip.font",
            new FontUIResource("Lucida Sans Unicode", Font.PLAIN, UIManager.getFont("ToolTip.font").getSize()));

    // Swing Settings
    LookAndFeel selectedLaf = options.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setPlasticTheme(options.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(options.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(options.isPlasticHighContrastFocusEnabled());
    } else if (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);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        Trace.trace(CLASS, "configureUI", "Can't change L&F", e);
    }

}

From source file:org.springframework.richclient.application.config.JGoodiesLooksConfigurer.java

License:Apache License

/**
 * @param highContrastEnabled set to <code>true</code> if high contrast should be enabled.
 * @see com.jgoodies.looks.plastic.PlasticLookAndFeel#setHighContrastFocusColorsEnabled(boolean)
 *///from  ww w  . j  a  v  a  2  s .c o  m
public void setHighContrastFocusColorsEnabled(boolean highContrastEnabled) {
    PlasticLookAndFeel.setHighContrastFocusColorsEnabled(highContrastEnabled);
}