Example usage for javax.swing PopupFactory setSharedInstance

List of usage examples for javax.swing PopupFactory setSharedInstance

Introduction

In this page you can find the example usage for javax.swing PopupFactory setSharedInstance.

Prototype

public static void setSharedInstance(PopupFactory factory) 

Source Link

Document

Sets the PopupFactory that will be used to obtain Popups.

Usage

From source file:net.sourceforge.squirrel_sql.client.Application.java

/**
 * Setup applications Look and Feel./*from   w ww  .j av a2  s  . c o m*/
 */
private void setupLookAndFeel(ApplicationArguments args) {
    /* 
     * Don't prevent the user from overriding the laf is they choose to use 
     * Swing's default laf prop 
     */
    String userSpecifiedOverride = System.getProperty("swing.defaultlaf");
    if (userSpecifiedOverride != null && !"".equals(userSpecifiedOverride)) {
        return;
    }

    String lafClassName = args.useNativeLAF() ? UIManager.getSystemLookAndFeelClassName()
            : MetalLookAndFeel.class.getName();

    if (!args.useDefaultMetalTheme()) {
        MetalLookAndFeel.setCurrentTheme(new AllBluesBoldMetalTheme());
    }

    try {
        // The following is a work-around for the problem on Mac OS X where
        // the Apple LAF delegates to the Swing Popup factory but then
        // tries to set a 90% alpha on the underlying Cocoa window, which
        // will always be null if you're using JGoodies L&F
        // see http://www.caimito.net/pebble/2005/07/26/1122392314480.html#comment1127522262179
        // This has no effect on Linux/Windows
        PopupFactory.setSharedInstance(new PopupFactory());

        UIManager.setLookAndFeel(lafClassName);
    } catch (Exception ex) {
        // i18n[Application.error.setlaf=Error setting LAF]
        s_log.error(s_stringMgr.getString("Application.error.setlaf"), ex);
    }
}