Example usage for javax.swing UIManager setLookAndFeel

List of usage examples for javax.swing UIManager setLookAndFeel

Introduction

In this page you can find the example usage for javax.swing UIManager setLookAndFeel.

Prototype

@SuppressWarnings("deprecation")
public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException,
        IllegalAccessException, UnsupportedLookAndFeelException 

Source Link

Document

Loads the LookAndFeel specified by the given class name, using the current thread's context class loader, and passes it to setLookAndFeel(LookAndFeel) .

Usage

From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java

public void setLocale(Locale locale) {
    super.setLocale(locale);

    Locale oldLocale = Locale.getDefault();

    Locale.setDefault(locale);//from   w  w w .  ja  v a2s .  c om

    resourceBundle = JavaUIResourceBundle.getInstance(locale);

    firePropertyChange(PROPERTY_LOCALE, oldLocale, locale);

    applyComponentOrientation(ComponentOrientation.getOrientation(getLocale()));

    SwingUtilities.updateComponentTreeUI(this);

    // Setting the look and feel is seemingly the only way to get
    // the JOptionPane.showConfirmDialog in exitApplication() to
    // use the correct button text for the new locale.
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception ex) {
    }
}

From source file:com.t3.client.TabletopTool.java

public static void main(String[] args) {
    if (MAC_OS_X) {
        // On OSX the menu bar at the top of the screen can be enabled at any time, but the
        // title (ie. name of the application) has to be set before the GUI is initialized (by
        // creating a frame, loading a splash screen, etc).  So we do it here.
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About TabletopTool...");
        System.setProperty("apple.awt.brushMetalLook", "true");
    }//  w  ww .j  a  va2  s. c  o m
    // Before anything else, create a place to store all the data
    try {
        AppUtil.getAppHome();
    } catch (Throwable t) {
        t.printStackTrace();

        // Create an empty frame so there's something to click on if the dialog goes in the background
        JFrame frame = new JFrame();
        SwingUtil.centerOnScreen(frame);
        frame.setVisible(true);

        String errorCreatingDir = "Error creating data directory";
        log.error(errorCreatingDir, t);
        JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
    verifyJavaVersion();

    configureLogging();

    // System properties
    System.setProperty("swing.aatext", "true");
    // System.setProperty("sun.java2d.opengl", "true");

    final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion());
    splash.showSplashScreen();

    // Protocol handlers
    // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?)
    RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory();
    factory.registerProtocol("asset", new AssetURLStreamHandler());
    URL.setURLStreamHandlerFactory(factory);

    MacroEngine.initialize();
    configureJide(); //TODO find out how to not call this twice without destroying error windows

    final Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getSystemEventQueue().push(new T3EventQueue());

    // LAF
    try {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        configureJide();
        if (WINDOWS)
            LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE);
        else
            LookAndFeelFactory.installJideExtension();
        if (MAC_OS_X) {
            macOSXicon();
        }
        menuBar = new AppMenuBar();
    } catch (Exception e) {
        TabletopTool.showError("msg.error.lafSetup", e);
        System.exit(1);
    }

    /**
     * This is a tweak that makes the Chinese version work better.
     * <p>
     * Consider reviewing <a
     * href="http://en.wikipedia.org/wiki/CJK_characters"
     * >http://en.wikipedia.org/wiki/CJK_characters</a> before making
     * changes. And http://www.scarfboy.com/coding/unicode-tool is also a
     * really cool site.
     */
    if (Locale.CHINA.equals(Locale.getDefault())) {
        // The following font name appears to be "Sim Sun".  It can be downloaded
        // from here:  http://fr.cooltext.com/Fonts-Unicode-Chinese
        Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12);
        FontUIResource fontRes = new FontUIResource(f);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource)
                UIManager.put(key, fontRes);
        }
    }

    // Draw frame contents on resize
    tk.setDynamicLayout(true);

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            initialize();
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    clientFrame.setVisible(true);
                    splash.hideSplashScreen();
                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            postInitialize();
                        }
                    });
                }
            });
        }
    });
    // new Thread(new HeapSpy()).start();
}

From source file:net.rptools.maptool.client.MapTool.java

public static void main(String[] args) {
    if (MAC_OS_X) {
        // On OSX the menu bar at the top of the screen can be enabled at any time, but the
        // title (ie. name of the application) has to be set before the GUI is initialized (by
        // creating a frame, loading a splash screen, etc).  So we do it here.
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About MapTool...");
        System.setProperty("apple.awt.brushMetalLook", "true");
    }//w  ww. ja va 2  s .  c  o  m
    // Before anything else, create a place to store all the data
    try {
        AppUtil.getAppHome();
    } catch (Throwable t) {
        t.printStackTrace();

        // Create an empty frame so there's something to click on if the dialog goes in the background
        JFrame frame = new JFrame();
        SwingUtil.centerOnScreen(frame);
        frame.setVisible(true);

        String errorCreatingDir = "Error creating data directory";
        log.error(errorCreatingDir, t);
        JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
    verifyJavaVersion();

    configureLogging();

    // System properties
    System.setProperty("swing.aatext", "true");
    // System.setProperty("sun.java2d.opengl", "true");

    final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion());
    splash.showSplashScreen();

    // Protocol handlers
    // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?)
    RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory();
    factory.registerProtocol("asset", new AssetURLStreamHandler());
    URL.setURLStreamHandlerFactory(factory);

    final Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getSystemEventQueue().push(new MapToolEventQueue());

    // LAF
    try {
        // If we are running under Mac OS X then save native menu bar look & feel components
        // Note the order of creation for the AppMenuBar, this specific chronology
        // allows the system to set up system defaults before we go and modify things.
        // That is, please don't move these lines around unless you test the result on windows and mac
        String lafname;
        if (MAC_OS_X) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            menuBar = new AppMenuBar();
            lafname = "net.rptools.maptool.client.TinyLookAndFeelMac";
            UIManager.setLookAndFeel(lafname);
            macOSXicon();
        }
        // If running on Windows based OS, CJK font is broken when using TinyLAF.
        //         else if (WINDOWS) {
        //            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        //            menuBar = new AppMenuBar();
        //         }
        else {
            lafname = "de.muntjak.tinylookandfeel.TinyLookAndFeel";
            UIManager.setLookAndFeel(lafname);
            menuBar = new AppMenuBar();
        }
        // After the TinyLAF library is initialized, look to see if there is a Default.theme
        // in our AppHome directory and load it if there is.  Unfortunately, changing the
        // search path for the default theme requires subclassing TinyLAF and because
        // we have both the original and a Mac version that gets cumbersome.  (Really
        // the Mac version should use the default and then install the keystroke differences
        // but what we have works and I'm loathe to go playing with it at 1.3b87 -- yes, 87!)
        File f = AppUtil.getAppHome("config");
        if (f.exists()) {
            File f2 = new File(f, "Default.theme");
            if (f2.exists()) {
                if (Theme.loadTheme(f2)) {
                    // re-install the Tiny Look and Feel
                    UIManager.setLookAndFeel(lafname);

                    // Update the ComponentUIs for all Components. This
                    // needs to be invoked for all windows.
                    //SwingUtilities.updateComponentTreeUI(rootComponent);
                }
            }
        }

        com.jidesoft.utils.Lm.verifyLicense("Trevor Croft", "rptools", "5MfIVe:WXJBDrToeLWPhMv3kI2s3VFo");
        LookAndFeelFactory.addUIDefaultsCustomizer(new LookAndFeelFactory.UIDefaultsCustomizer() {
            public void customize(UIDefaults defaults) {
                // Remove red border around menus
                defaults.put("PopupMenu.foreground", Color.lightGray);
            }
        });
        LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE);

        /****************************************************************************
         * For TinyLAF 1.3.04 this is how the color was changed for a
         * button.
         */
        // Theme.buttonPressedColor[Theme.style] = new ColorReference(Color.gray);

        /****************************************************************************
         * And this is how it's done in TinyLAF 1.4.0 (no idea about the
         * intervening versions).
         */
        Theme.buttonPressedColor = new SBReference(Color.GRAY, 0, -6, SBReference.SUB3_COLOR);

        configureJide();
    } catch (Exception e) {
        MapTool.showError("msg.error.lafSetup", e);
        System.exit(1);
    }

    /**
     * This is a tweak that makes the Chinese version work better.
     * <p>
     * Consider reviewing <a
     * href="http://en.wikipedia.org/wiki/CJK_characters"
     * >http://en.wikipedia.org/wiki/CJK_characters</a> before making
     * changes. And http://www.scarfboy.com/coding/unicode-tool is also a
     * really cool site.
     */
    if (Locale.CHINA.equals(Locale.getDefault())) {
        // The following font name appears to be "Sim Sun".  It can be downloaded
        // from here:  http://fr.cooltext.com/Fonts-Unicode-Chinese
        Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12);
        FontUIResource fontRes = new FontUIResource(f);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource)
                UIManager.put(key, fontRes);
        }
    }

    // Draw frame contents on resize
    tk.setDynamicLayout(true);

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            initialize();
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    clientFrame.setVisible(true);
                    splash.hideSplashScreen();
                    EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            postInitialize();
                        }
                    });
                }
            });
        }
    });
    // new Thread(new HeapSpy()).start();
}

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
  * @param args//from w w w  . j  av  a  2  s.  c  o  m
  */
public static void main(String[] args) {
    setAppName("Specify"); //$NON-NLS-1$
    System.setProperty(AppPreferences.factoryName, "edu.ku.brc.specify.config.AppPrefsDBIOIImpl"); // Needed by AppReferences //$NON-NLS-1$

    for (String s : args) {
        String[] pairs = s.split("="); //$NON-NLS-1$
        if (pairs.length == 2) {
            if (pairs[0].startsWith("-D")) //$NON-NLS-1$
            {
                //System.err.println("["+pairs[0].substring(2, pairs[0].length())+"]["+pairs[1]+"]");
                System.setProperty(pairs[0].substring(2, pairs[0].length()), pairs[1]);
            }
        } else {
            String symbol = pairs[0].substring(2, pairs[0].length());
            //System.err.println("["+symbol+"]");
            System.setProperty(symbol, symbol);
        }
    }

    // Now check the System Properties
    String appDir = System.getProperty("appdir");
    if (StringUtils.isNotEmpty(appDir)) {
        UIRegistry.setDefaultWorkingPath(appDir);
    }

    String appdatadir = System.getProperty("appdatadir");
    if (StringUtils.isNotEmpty(appdatadir)) {
        UIRegistry.setBaseAppDataDir(appdatadir);
    }

    // Then set this
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons.xml")); //$NON-NLS-1$
    //ImageIcon icon = IconManager.getIcon("AppIcon", IconManager.IconSize.Std16);

    try {
        ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$

    } catch (MissingResourceException ex) {
        Locale.setDefault(Locale.ENGLISH);
        UIRegistry.setResourceLocale(Locale.ENGLISH);
    }

    try {
        if (!System.getProperty("os.name").equals("Mac OS X")) {
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            PlasticLookAndFeel.setPlasticTheme(new DesertBlue());
        }
    } catch (Exception e) {
        //whatever
    }
    AppPreferences localPrefs = AppPreferences.getLocalPrefs();
    localPrefs.setDirPath(UIRegistry.getAppDataDir());

    boolean doIt = false;
    if (doIt)

    {
        Charset utf8charset = Charset.forName("UTF-8");
        Charset iso88591charset = Charset.forName("ISO-8859-1");

        ByteBuffer inputBuffer = ByteBuffer.wrap(new byte[] { (byte) 0xC3, (byte) 0xA2 });

        // decode UTF-8
        CharBuffer data = utf8charset.decode(inputBuffer);

        // encode ISO-8559-1
        ByteBuffer outputBuffer = iso88591charset.encode(data);
        byte[] outputData = outputBuffer.array();
        System.out.println(new String(outputData));
        return;
    }

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                UIHelper.OSTYPE osType = UIHelper.getOSType();
                if (osType == UIHelper.OSTYPE.Windows) {
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                    PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());

                } else if (osType == UIHelper.OSTYPE.Linux) {
                    UIManager.setLookAndFeel(new PlasticLookAndFeel());
                }
            } catch (Exception e) {
                log.error("Can't change L&F: ", e); //$NON-NLS-1$
            }

            JFrame frame = new JFrame(getResourceString("StrLocalizerApp.AppTitle"));
            frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            final StrLocalizerAppForiOS sl = new StrLocalizerAppForiOS();
            sl.addMenuBar(frame);
            frame.setContentPane(sl);
            frame.setSize(768, 1024);

            //Dimension size = frame.getPreferredSize();
            //size.height = 500;
            //frame.setSize(size);
            frame.addWindowListener(sl);
            IconManager.setApplicationClass(Specify.class);
            frame.setIconImage(IconManager.getImage(IconManager.makeIconName("SpecifyWhite32")).getImage());

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    sl.startUp();
                }
            });
        }
    });
}

From source file:com.commander4j.util.JUtility.java

public static void SetLookAndFeel(String LOOKANDFEEL, String THEME) {
    try {/*from  w  w w  . j a  va  2 s. c o  m*/
        if (LOOKANDFEEL.equals("Metal")) {
            if (THEME.equals("DefaultMetal"))
                MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
            else if (THEME.equals("Ocean"))
                MetalLookAndFeel.setCurrentTheme(new OceanTheme());

            UIManager.setLookAndFeel(new MetalLookAndFeel());

        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:eu.apenet.dpt.standalone.gui.DataPreparationToolGUI.java

public static void main(String[] args) throws Exception {
    try {/*from   w  w  w. j a  va  2s. c  o m*/
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
        e.printStackTrace();
    }

    Logger.getRootLogger().setLevel(Level.INFO);
    DataPreparationToolGUI dataPreparationToolGUI = new DataPreparationToolGUI();
    if (args.length == 1 && args[0].equals("dev")) {
        Utilities.isDev = true;
    }
    dataPreparationToolGUI.setupTool();
    dataPreparationToolGUI.setVisible(true);
}

From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*  www  .ja  va2  s .c  o  m*/
private static void createAndShowGUI() {
    try {
        String callbackHandlerClassName = ProviderProperties.getInstance().getProperty(
                "jaxr-ebxml.security.jaas.callbackHandlerClassName",
                System.getProperty("jaxr-ebxml.security.jaas.callbackHandlerClassName"));

        if ((callbackHandlerClassName == null) || (callbackHandlerClassName.length() == 0)) {
            System.setProperty("jaxr-ebxml.security.jaas.callbackHandlerClassName",
                    "it.cnr.icar.eric.client.xml.registry.jaas.DialogAuthenticationCallbackHandler");
        }

        // By default JDialog and JFrame will not follow theme changes.
        // JDialog.setDefaultLookAndFeelDecorated(true);
        // JFrame.setDefaultLookAndFeelDecorated(true);
        // I18N: Do not localize next statement.
        System.setProperty("sun.awt.noerasebackground", "true");
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        // I18N: Do not localize next statement.
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        // Create a new instance of our application's frame, and make it
        // visible.
        RegistryBrowser browser = getInstance();

        browser.pack();

        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

        browser.setBounds(0, 0, (int) (dim.getWidth()), (int) (dim.getHeight()));

        browser.setVisible(true);
    } catch (Throwable t) {
        log.fatal(t);
        t.printStackTrace();

        // Ensure the application exits with an error condition.
        System.exit(1);
    }
}

From source file:gov.noaa.ncdc.iosp.avhrr.util.AvhrrLevel1B2Netcdf.java

/**
 * @param args/*from  www .ja v a2  s.  c o m*/
 *            the command line arguments
 */
public static void main(String args[]) throws Exception {
    // create the Options object
    Options options = new Options();
    options.addOption(OPTION_NOGUI, false, "command line mode");
    options.addOption(OPTION_ALLVAR, false, "Process all channels");
    options.addOption(OPTION_CH1, false, "Process channel 1");
    options.addOption(OPTION_CH2, false, "Process channel 2");
    options.addOption(OPTION_CH3, false, "Process channel 3");
    options.addOption(OPTION_CH4, false, "Process channel 4");
    options.addOption(OPTION_CH5, false, "Process channel 5");
    options.addOption(OPTION_DEFAULT, false,
            "Output All Channels, Brightness Temperature and Latitude and  Longitude");
    options.addOption(OPTION_TEMP, false, "Output calibrated temperatures/albedos");
    options.addOption(OPTION_RAW, false, "Output raw values");
    options.addOption(OPTION_RADIANCE, false, "Output radiance values");
    options.addOption(OPTION_LATLON, false, "Output latitude and longitude");
    options.addOption(OPTION_ALLVAR, false, "Output all variables)");
    options.addOption(OPTION_CLOBBER, false, "Overwrite existing netCDF file.");
    options.addOption(OPTION_CALIBRATION, false, "Output calibration variables");
    options.addOption(OPTION_QUALITY, false, "Output quality variables.");
    options.addOption(OPTION_METADATA, false, "Output metadata variables.");
    options.addOption("memory", false, "java heap space.");

    Option logOption = new Option("logFile", true, "Send output to file");
    options.addOption(logOption);
    Option outdirOption = new Option("outputdir", true, "Output Directory.");
    options.addOption(outdirOption);

    // 2nd way is by creating an Option and then adding it
    Option timeOption = new Option(OPTION_AVHRR, true, "Process the Level1B file");
    timeOption.setRequired(false);
    options.addOption(timeOption);

    // now lets parse the input
    CommandLineParser parser = new BasicParser();
    CommandLine cmd;
    try {
        cmd = parser.parse(options, args);
    } catch (ParseException pe) {
        usage(options);
        return;
    }

    // now lets interrogate the options and execute the relevant parts
    if (cmd.hasOption(OPTION_NOGUI)) {
        // process command line args - need to refactor this (doing this
        // twice--BAD!!!!!)
        List<String> list = processCommandLineArgs(cmd);
        String file = cmd.getOptionValue(OPTION_AVHRR);
        if (null == file) {
            System.out.println("You must specify a file to convert!! missing -avhrr argument");
            usage(options);
            return;
        }

        String outdir = cmd.getOptionValue("outputdir");
        if (null == outdir || outdir.trim().length() < 1) {
            File f = new File(".");
            outdir = f.getAbsolutePath();
        }
        //         try {
        Avhrr2Netcdf.convert(file, list, outdir);
        //         } catch (Exception e) {
        //            System.out.println("this blew up");
        // TODO Auto-generated catch block
        //            e.printStackTrace();
        //         }
    } else {

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
                for (int i = 0; i < info.length; i++) {
                    // Get the name of the look and feel that is suitable
                    // for
                    // display to the user
                    String className = info[i].getClassName();
                }
                String javaLF = UIManager.getSystemLookAndFeelClassName();
                try {
                    // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
                    UIManager.setLookAndFeel(javaLF);
                } catch (ClassNotFoundException e) {
                    // log.error(e.getMessage());
                } catch (InstantiationException e) {
                    // log.error(e.getMessage());
                } catch (IllegalAccessException e) {
                    // log.error(e.getMessage());
                } catch (UnsupportedLookAndFeelException e) {
                    // log.error(e.getMessage());
                }
                mFrame = new AvhrrLevel1B2Netcdf();
                mFrame.setVisible(true);
            }
        });
    }
}

From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java

public static void main(String args[]) {

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                Color SELECTED_COLOR = new Color(184, 204, 217);
                Color BASE_COLOR = new Color(220, 231, 243, 50);
                Color ALT_COLOR = new Color(220, 231, 243, 115);

                //                    Insets MENU_INSETS = new Insets(1,12,2,5);//default values
                //                    Font MENU_FONT = new Font("SansSerif ", Font.PLAIN, 12);//default values

                //                    UIManager.put("nimbusBase", BASE_COLOR);
                UIManager.put("nimbusSelection", SELECTED_COLOR);
                UIManager.put("nimbusSelectionBackground", SELECTED_COLOR);
                UIManager.put("Menu[Enabled+Selected].backgroundPainter", SELECTED_COLOR);

                //override defaults
                for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                    if (info.getName().equals("Nimbus")) {
                        UIManager.setLookAndFeel(info.getClassName());
                        UIDefaults defaults = UIManager.getLookAndFeelDefaults();
                        defaults.put("Table.gridColor", Color.lightGray);
                        defaults.put("Table.disabled", false);
                        defaults.put("Table.showGrid", true);
                        defaults.put("Table.intercellSpacing", new Dimension(1, 1));
                        break;
                    }//from  w  ww  .  j a  va 2s  .  c  o  m
                }

                //                    UIManager.put("TitledBorder.position", TitledBorder.TOP);

                //                    UIManager.put("Table.showGrid", true);
                //                    UIManager.put("Table.gridColor", Color.RED);
                //                    UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
            } catch (UnsupportedLookAndFeelException ulafe) {
                //                    logger.fatal("Substance failed to set", ulafe);
            } catch (Exception ex) {
                //                    logger.fatal(ex.getMessage(), ex);
            }

            JFrame frame = new Jmetrik();

            //            set window to maximum size but account for taskbar
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            Rectangle rect = env.getMaximumWindowBounds();
            int width = Double.valueOf(rect.getWidth() - 1.0).intValue();
            int height = Double.valueOf(rect.getHeight() - 1.0).intValue();
            frame.setMaximizedBounds(new Rectangle(0, 0, width, height));
            frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            frame.pack();
            //            frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
            frame.setVisible(true);

            //check for updates to jmetrik
            ((Jmetrik) frame).checkForUpdates();
        }
    });

}

From source file:pi.bestdeal.gui.InterfacePrincipale.java

/**
 * @param args the command line arguments
 *//* www  .j a v a  2s  .c  om*/
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */

    try {
        UIManager.setLookAndFeel(new AluminiumLookAndFeel());

    } catch (UnsupportedLookAndFeelException ex) {
        Logger.getLogger(InterfacePrincipale.class.getName()).log(Level.SEVERE, null, ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {

            new InterfacePrincipale().setVisible(true);

        }
    });
}