com.jgoodies.looks.LookUtils Java Examples

The following examples show how to use com.jgoodies.looks.LookUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BsafTest.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void startup ()
{
    String lafName =
            LookUtils.IS_OS_WINDOWS_XP
            ? com.jgoodies.looks.Options.getCrossPlatformLookAndFeelClassName()
            : com.jgoodies.looks.Options.getSystemLookAndFeelClassName();

    try {
        UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }


    JFrame frame = getMainFrame();
    frame.setJMenuBar(buildMenuBar());
    frame.setContentPane(buildContentPane());
    frame.setSize(600, 400);
    frame.setTitle("BSAF Test");
    show(frame);
}
 
Example #2
Source File: Tiny.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Configures the UI; tries to set the system look on Mac, 
 * <code>WindowsLookAndFeel</code> on general Windows, and
 * <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.<p>
 * 
 * The JGoodies Swing Suite's <code>ApplicationStarter</code>,
 * <code>ExtUIManager</code>, and <code>LookChoiceStrategies</code>
 * classes provide a much more fine grained algorithm to choose and
 * restore a look and theme.
 */
private void configureUI() {
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    //Options.setGlobalFontSizeHints(FontSizeHints.MIXED);
    Options.setDefaultIconSize(new Dimension(18, 18));

    String lafName =
        LookUtils.IS_OS_WINDOWS_XP
            ? Options.getCrossPlatformLookAndFeelClassName()
            : Options.getSystemLookAndFeelClassName();

    try {
        UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }
}
 
Example #3
Source File: Envisage.java    From attic-polygene-java with Apache License 2.0 4 votes vote down vote up
private void initLookAndFeel()
{
    String osName = System.getProperty( "os.name" ).toUpperCase();

    // set to use swing anti alias text only for JVM <= 1.5
    System.setProperty( "swing.aatext", "true" );

    // set default swing bold to false, only for JVM 1.5 or above
    UIManager.put( "swing.boldMetal", Boolean.FALSE );

    // set LaF
    LookAndFeel lnf = UIManager.getLookAndFeel();
    if( lnf != null && lnf.getID().equalsIgnoreCase( "Metal" ) )
    {
        final String lnfClassName;
        if( osName.startsWith( "MAC" ) )
        {
            System.setProperty( "com.apple.mrj.application.apple.menu.about.name", "Envisage" ); //TODO i18n
            System.setProperty( "apple.laf.useScreenMenuBar", "true" );
            lnfClassName = UIManager.getSystemLookAndFeelClassName();
        }
        else if( osName.startsWith( "WINDOWS" ) )
        {
            UIManager.put( "ClassLoader", LookUtils.class.getClassLoader() );
            lnfClassName = Options.getSystemLookAndFeelClassName();
            Options.setUseNarrowButtons( false );
        }
        else
        {
            UIManager.put( "ClassLoader", LookUtils.class.getClassLoader() );
            lnfClassName = Options.getCrossPlatformLookAndFeelClassName();
            PlasticLookAndFeel.setTabStyle( PlasticLookAndFeel.TAB_STYLE_METAL_VALUE );
            PlasticLookAndFeel.setPlasticTheme( new ExperienceBlue() );
            Options.setUseNarrowButtons( false );
            //PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlueDefaultFont());  // for CJK Font
        }

        if( lnfClassName != null )
        {
            try
            {
                UIManager.setLookAndFeel( lnfClassName );
            }
            catch( ClassNotFoundException | IllegalAccessException | InstantiationException |
                   UnsupportedLookAndFeelException ex )
            {
                System.err.println( "Unable to set LookAndFeel, use default LookAndFeel.\n" + ex.getMessage() );
            }
        }
    }
}