Example usage for javax.swing UIManager put

List of usage examples for javax.swing UIManager put

Introduction

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

Prototype

public static Object put(Object key, Object value) 

Source Link

Document

Stores an object in the developer defaults.

Usage

From source file:tvbrowser.TVBrowser.java

private static void updateLookAndFeel() {
    try {/* w  w w. j a  va2s .  c o m*/
        if (OperatingSystem.isWindows()) {
            UIManager.installLookAndFeel("Extended Windows", "com.jgoodies.looks.windows.WindowsLookAndFeel");
        }
        UIManager.installLookAndFeel("Plastic", "com.jgoodies.looks.plastic.PlasticLookAndFeel");
        UIManager.installLookAndFeel("Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        UIManager.installLookAndFeel("Plastic XP", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
        UIManager.installLookAndFeel("Skin", "com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
        /*
              Map<String, SkinInfo> substanceSkins = SubstanceLookAndFeel.getAllSkins();
              if (substanceSkins != null) {
                for (SkinInfo skin : substanceSkins.values()) {
                  String className = skin.getClassName();
                  UIManager.installLookAndFeel("Substance " + skin.getDisplayName(), StringUtils.replace(StringUtils.replace(className, "Skin", "LookAndFeel"), "skin.", "skin.Substance"));
                }
              }
        */
    } catch (Exception e1) {
        // ignore any exception for optional skins
        e1.printStackTrace();
    }

    if (Settings.propLookAndFeel.getString().equals("com.l2fprod.gui.plaf.skin.SkinLookAndFeel")) {
        String themepack = Settings.propSkinLFThemepack.getString();
        try {
            File themepackFile = new File(themepack);
            if (!themepackFile.exists()) {
                themepackFile = new File(Settings.getUserDirectoryName(), themepack);
            }

            if (!themepackFile.exists() && OperatingSystem.isMacOs()) {
                themepackFile = new File("/Library/Application Support/TV-Browser/", themepack);
            }

            SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themepackFile.getAbsolutePath()));
        } catch (Exception exc) {
            ErrorHandler.handle("Could not load themepack.\nSkinLF is disabled now", exc);
            Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault());
        }
    } else if (Settings.propLookAndFeel.getString().startsWith("com.jgoodies")) {
        com.jgoodies.looks.Options.setPopupDropShadowEnabled(Settings.propJGoodiesShadow.getBoolean());
        UIManager.put("jgoodies.popupDropShadowEnabled",
                Boolean.valueOf(Settings.propJGoodiesShadow.getBoolean()));
        try {
            LookUtils.setLookAndTheme(
                    (LookAndFeel) Class.forName(Settings.propLookAndFeel.getString()).newInstance(),
                    Class.forName(Settings.propJGoodiesTheme.getString()).newInstance());
        } catch (Throwable e) {
            ErrorHandler.handle("Could not load themepack.\nJGoodies is disabled now", e);
            Settings.propLookAndFeel.setString(Settings.propLookAndFeel.getDefault());
        }
    }

    if (curLookAndFeel == null || !curLookAndFeel.equals(Settings.propLookAndFeel.getString())) {
        try {
            curLookAndFeel = Settings.propLookAndFeel.getString();
            // check if LnF is still available
            boolean foundCurrent = lookAndFeelExists(curLookAndFeel);
            // reset look and feel?
            if (!foundCurrent) {
                if (JOptionPane.showConfirmDialog(null, mLocalizer.msg("lnfMissing",
                        "The look and feel '{0}' is no longer available,\nso the default look and feel will be used.\n\nDo you want to set the look and feel option to the default look and feel?",
                        curLookAndFeel), mLocalizer.msg("lnfMissing.title", "Look and feel missing"),
                        JOptionPane.WARNING_MESSAGE | JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                    Settings.propLookAndFeel.resetToDefault();
                    curLookAndFeel = Settings.propLookAndFeel.getString();
                    foundCurrent = true;
                }
            }
            if (foundCurrent) {
                UIThreadRunner.invokeAndWait(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            UIManager.setLookAndFeel(curLookAndFeel);
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        mLog.info("setting look and feel to " + curLookAndFeel);
                    }
                });
            }
        } catch (Exception exc) {
            String msg = mLocalizer.msg("error.1", "Unable to set look and feel.", exc);
            ErrorHandler.handle(msg, exc);
        }
    }

    // set colors for action pane at UIManager
    UIManager.put("TaskPane.foreGround", UIManager.get("Button.foreground"));

    if (UIManager.getColor("List.selectionBackground") == null) {
        UIManager.put("List.selectionBackground", UIManager.getColor("Tree.selectionBackground"));
    }
    if (UIManager.getColor("List.selectionForeground") == null) {
        UIManager.put("List.selectionForeground", UIManager.getColor("Tree.selectionForeground"));
    }
    if (UIManager.getColor("MenuItem.selectionForeground") == null) {
        UIManager.put("MenuItem.selectionForeground", UIManager.getColor("Tree.selectionForeground"));
    }
    if (UIManager.getColor("ComboBox.disabledForeground") == null) {
        UIManager.put("ComboBox.disabledForeground", Color.gray);
    }

    if (mainFrame != null) {
        SwingUtilities.updateComponentTreeUI(mainFrame);
        mainFrame.validate();
    }
    lookAndFeelInitialized = true;
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.restserver.GiftCloudLoginDialog.java

public PasswordAuthentication getPasswordAuthentication(final String prompt) {
    // Set the default background colour to white
    UIManager UI = new UIManager();
    UI.put("OptionPane.background", Color.white);
    UI.put("Panel.background", Color.white);

    String defaultUserName = "";
    if (giftCloudProperties.getLastUserName().isPresent()) {
        defaultUserName = giftCloudProperties.getLastUserName().get();
    }// ww  w .  ja v a  2  s.c o m

    // Create a panel for entering username and password
    final JPanel usernamePasswordPanel = new JPanel(new GridBagLayout());

    final JLabel promptField = new JLabel(prompt, SwingConstants.CENTER);
    final JTextField usernameField = new JTextField(defaultUserName, 16);
    final JPasswordField passwordField = new JPasswordField(16);

    // Add a special listener to get the focus onto the username field when the component is created, or password if the username has already been populated from the default value
    if (StringUtils.isBlank(defaultUserName)) {
        usernameField.addAncestorListener(new RequestFocusListener());
    } else {
        passwordField.addAncestorListener(new RequestFocusListener());
    }

    usernamePasswordPanel.add(promptField, promptConstraint);
    usernamePasswordPanel.add(new JLabel("Username:"), labelConstraint);
    usernamePasswordPanel.add(usernameField, fieldConstraint);
    usernamePasswordPanel.add(new JLabel("Password:"), labelConstraint);
    usernamePasswordPanel.add(passwordField, fieldConstraint);

    // Show the login dialog
    final int returnValue = JOptionPane.showConfirmDialog(new JDialog(getFrame(parent)), usernamePasswordPanel,
            LOGIN_DIALOG_TITLE, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, icon);

    if (JOptionPane.OK_OPTION == returnValue) {
        giftCloudProperties.setLastUserName(usernameField.getText());
        giftCloudProperties.setLastPassword(passwordField.getPassword());
        giftCloudProperties.save();

        return new PasswordAuthentication(usernameField.getText(), passwordField.getPassword());
    } else {
        return null;
    }
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.GiftCloudDialogs.java

public GiftCloudDialogs(final GiftCloudUploaderAppConfiguration appConfiguration, final MainFrame mainFrame) {
    this.mainFrame = mainFrame;
    this.applicationName = appConfiguration.getApplicationTitle();

    // Create the object used for creating user login dialogs if necessary. Note this does not create any GUI in the constructor
    loginDialog = new GiftCloudLoginDialog(appConfiguration, appConfiguration.getProperties(),
            mainFrame.getContainer());/*from  w  ww . ja v a2 s  .  com*/

    // Set the default background colour to white
    UIManager UI = new UIManager();
    UI.put("OptionPane.background", Color.white);
    UI.put("Panel.background", Color.white);

    // Get the GIFT-Cloud icon - this will return null if not found
    icon = appConfiguration.getMainLogo();
}

From source file:uk.co.modularaudio.componentdesigner.ComponentDesignerLauncher.java

public static void main(final String[] args) throws Exception {
    FontResetter.turnOnGlobalAaText();/* w  ww  .ja  va2s .c o m*/

    boolean useSystemLookAndFeel = false;

    boolean showAlpha = false;
    boolean showBeta = false;
    String additionalBeansResource = null;
    String additionalConfigResource = null;

    String configResourcePath = CDCONFIG_PROPERTIES;

    if (args.length > 0) {
        for (int i = 0; i < args.length; ++i) {
            final String arg = args[i];
            if (arg.equals("--useSlaf")) {
                useSystemLookAndFeel = true;
            } else if (arg.equals("--beta")) {
                showBeta = true;
            } else if (arg.equals("--alpha")) {
                showAlpha = true;
                showBeta = true;
            } else if (arg.equals("--pluginJar")) {
                additionalBeansResource = PLUGIN_BEANS_RESOURCE_PATH;
                additionalConfigResource = PLUGIN_CONFIG_RESOURCE_PATH;

                if (log.isDebugEnabled()) {
                    log.debug("Will append plugin beans: " + additionalBeansResource);
                    log.debug("Will append plugin config file: " + additionalConfigResource);
                }
            } else if (arg.equals("--development")) {
                // Let me specify certain things with hard paths
                configResourcePath = CDDEVELOPMENT_PROPERTIES;
                log.info("In development mode. Will use development properties for configuration");
            } else if (arg.equals("--jprofiler")) {
                configResourcePath = CDJPROFILER_PROPERTIES;
                log.info("In jprofiler mode - using jprofiler properties for configuration");
            } else {
                final String msg = "Unknown command line argument: " + arg;
                log.error(msg);
                throw new DatastoreException(msg);
            }
        }
        if (useSystemLookAndFeel) {
            log.info("System look and feel activated");
        }
        if (showAlpha) {
            log.info("Showing alpha components");
        }
        if (showBeta) {
            log.info("Showing beta components");
        }
    }

    if (useSystemLookAndFeel) {
        final String gtkLookAndFeelClassName = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        boolean foundGtkLaf = false;

        final LookAndFeelInfo lafis[] = UIManager.getInstalledLookAndFeels();

        for (final LookAndFeelInfo lafi : lafis) {
            final String lc = lafi.getClassName();
            if (lc.equals(gtkLookAndFeelClassName)) {
                foundGtkLaf = true;
                break;
            }
        }

        if (foundGtkLaf) {
            log.debug("Found available GTK laf. Will set active");
            UIManager.setLookAndFeel(gtkLookAndFeelClassName);
        }
        UIManager.put("Slider.paintValue", Boolean.FALSE);
    }

    final Font f = Font.decode("");
    final String fontName = f.getName();
    FontResetter.setUIFontFromString(fontName, Font.PLAIN, 10);

    log.debug("ComponentDesigner starting.");
    // Set the fft library to only use current thread
    JTransformsConfigurator.setThreadsToOne();

    final ComponentDesignerLauncher application = new ComponentDesignerLauncher();
    application.init(configResourcePath, additionalBeansResource, additionalConfigResource, showAlpha,
            showBeta);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            try {
                application.go();
                application.registerCloseAction();
            } catch (final Exception e) {
                final String msg = "Exception caught at top level of ComponentDesigner launch: " + e.toString();
                log.error(msg, e);
                System.exit(0);
            }
            log.debug("Leaving runnable run section.");
        }
    });
}

From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java

public OpenBSTGUI() {
    instance = this;
    UIManager.put("OptionPane.errorIcon", new ImageIcon(Icons.getImage("Cancel", 48)));
    UIManager.put("OptionPane.informationIcon", new ImageIcon(Icons.getImage("About", 48)));
    UIManager.put("OptionPane.questionIcon", new ImageIcon(Icons.getImage("Rename", 48)));
    UIManager.put("OptionPane.warningIcon", new ImageIcon(Icons.getImage("Error", 48)));

    BorderLayout borderLayout = new BorderLayout();
    borderLayout.setVgap(4);//from w ww . ja v  a 2s. c o m
    getContentPane().setLayout(borderLayout);
    setIconImage(Icons.getImage("Logo", 48));
    setTitle("OpenBST " + OpenBST.VERSION);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            boolean cancelled = false;
            int i = 0;
            for (Component c : container.getComponents()) {
                if (c instanceof StoryPanel) {
                    i++;
                } else if (c instanceof StoryEditor) {
                    container.setSelectedComponent(c);
                    if (((StoryEditor) c).askClose()) {
                        continue;
                    } else {
                        cancelled = true;
                        break;
                    }
                }
            }
            if (!cancelled) {
                if (i > 0) {
                    int j = Messagers.showConfirm(OpenBSTGUI.this,
                            "You are about to close " + i + " file(s). Are you sure you wish to exit OpenBST?",
                            Messagers.OPTIONS_YES_NO, Messagers.TYPE_WARNING, "Closing OpenBST");
                    if (j != Messagers.OPTION_YES)
                        cancelled = true;
                }
                if (!cancelled)
                    System.exit(0);
            }
        }

    });

    JMenuBar jmb = new JMenuBar();
    jmb.setBackground(OPENBST_BLUE);
    jmb.add(Box.createHorizontalGlue());
    jmb.add(createShortMenu());
    jmb.add(Box.createHorizontalGlue());
    this.setJMenuBar(jmb);

    addDarkModeCallback(b -> {
        jmb.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE);
    });

    container = new JTabbedPane();
    container.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    container.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(final MouseEvent e) {
            if (SwingUtilities.isMiddleMouseButton(e)) {
                final int i = container.indexAtLocation(e.getX(), e.getY());
                System.out.println(i);
                if (i > -1) {
                    Component c = container.getComponentAt(i);
                    if (c instanceof StoryPanel) {
                        container.setSelectedComponent(c);
                        ((StoryPanel) c).askClose();
                    } else if (c instanceof StoryEditor) {
                        container.setSelectedComponent(c);
                        ((StoryEditor) c).askClose();
                    }
                }
            }
        }
    });
    getContentPane().add(container, BorderLayout.CENTER);

    final JBackgroundPanel welcomeContentPanel = new JBackgroundPanel(Icons.getRandomBackground(),
            Image.SCALE_FAST);
    background = welcomeContentPanel;

    welcomeContentPanel.setLayout(new MigLayout("hidemode 2", "[grow,center]", "[][grow][]"));
    container.add(welcomeContentPanel);
    container.setTitleAt(0, Lang.get("welcome"));

    bannersPanel = new JPanel(new MigLayout("hidemode 2, gap 0px, fill, wrap 1, ins 0"));
    bannersPanel.setBackground(new Color(0, 0, 0, 0));
    welcomeContentPanel.add(bannersPanel, "cell 0 0,grow");

    if (OpenBST.VERSION.endsWith("u")) {
        JButton btnReportBugs = new JButton(Lang.get("welcome.reportbugs"));
        btnReportBugs.addActionListener(e -> {
            VisualsUtils.browse("https://github.com/utybo/BST/issues");
        });
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.YELLOW,
                Lang.get("welcome.ontheedge"), btnReportBugs, false), "grow");
    } else if (OpenBST.VERSION.contains("SNAPSHOT")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.ORANGE,
                Lang.get("welcome.snapshot"), null, false), "grow");
    }

    if (System.getProperty("java.specification.version").equals("9")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)),
                new Color(255, 50, 50), Lang.get("welcome.java9warning"), null, false), "grow");
    }
    if (System.getProperty("java.specification.version").equals("10")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)),
                new Color(255, 50, 50), Lang.get("welcome.java10warning"), null, false), "grow");
    }

    JButton btnJoinDiscord = new JButton(Lang.get("openbst.discordjoin"));
    btnJoinDiscord.addActionListener(e -> {
        VisualsUtils.browse("https://discord.gg/6SVDCMM");
    });
    bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Discord", 48)), DISCORD_COLOR,
            Lang.get("openbst.discord"), btnJoinDiscord, true), "grow");

    JPanel panel = new JPanel();
    panel.setBackground(new Color(0, 0, 0, 0));
    welcomeContentPanel.add(panel, "flowx,cell 0 1,growx,aligny center");
    panel.setLayout(new MigLayout("", "[40%][][][][60%,growprio 50]", "[][grow]"));

    final JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogo", 48)));
    addDarkModeCallback(b -> lblOpenbst
            .setIcon(new ImageIcon(b ? Icons.getImage("FullLogoWhite", 48) : Icons.getImage("FullLogo", 48))));
    panel.add(lblOpenbst, "flowx,cell 0 0 1 2,alignx trailing,aligny center");

    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    panel.add(separator, "cell 2 0 1 2,growy");

    final JLabel lblWelcomeToOpenbst = new JLabel("<html>" + Lang.get("welcome.intro"));
    lblWelcomeToOpenbst.setMaximumSize(new Dimension(350, 999999));
    panel.add(lblWelcomeToOpenbst, "cell 4 0");

    Component horizontalStrut = Box.createHorizontalStrut(10);
    panel.add(horizontalStrut, "cell 1 1");

    Component horizontalStrut_1 = Box.createHorizontalStrut(10);
    panel.add(horizontalStrut_1, "cell 3 1");

    final JButton btnOpenAFile = new JButton(Lang.get("welcome.open"));
    panel.add(btnOpenAFile, "flowx,cell 4 1");
    btnOpenAFile.setIcon(new ImageIcon(Icons.getImage("Open", 40)));
    btnOpenAFile.addActionListener(e -> {
        openStory(VisualsUtils.askForFile(this, Lang.get("file.title")));
    });

    final JButton btnOpenEditor = new JButton(Lang.get("welcome.openeditor"));
    panel.add(btnOpenEditor, "cell 4 1");
    btnOpenEditor.setIcon(new ImageIcon(Icons.getImage("Edit Property", 40)));
    btnOpenEditor.addActionListener(e -> {
        openEditor(VisualsUtils.askForFile(this, Lang.get("file.title")));
    });

    JButton btnChangeBackground = new JButton(Lang.get("welcome.changebackground"),
            new ImageIcon(Icons.getImage("Change Theme", 16)));
    btnChangeBackground.addActionListener(e -> {
        BufferedImage prev = background.getImage();
        BufferedImage next;
        do {
            next = Icons.getRandomBackground();
        } while (prev == next);
        background.setImage(next);
    });
    welcomeContentPanel.add(btnChangeBackground, "flowx,cell 0 2,alignx left");

    JButton btnWelcomepixabay = new JButton(Lang.get("welcome.pixabay"),
            new ImageIcon(Icons.getImage("External Link", 16)));
    btnWelcomepixabay.addActionListener(e -> {
        VisualsUtils.browse("https://pixabay.com");

    });
    welcomeContentPanel.add(btnWelcomepixabay, "cell 0 2");

    JLabel creds = new JLabel(Lang.get("welcome.credits"));
    creds.setEnabled(false);
    welcomeContentPanel.add(creds, "cell 0 2, gapbefore 10px");

    setSize((int) (830 * Icons.getScale()), (int) (480 * Icons.getScale()));
    setLocationRelativeTo(null);
}

From source file:VASSAL.launch.StartUp.java

protected void initUIProperties() {
    System.setProperty("swing.aatext", "true"); //$NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("swing.boldMetal", "false"); //$NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("awt.useSystemAAFontSettings", "on"); //$NON-NLS-1$ //$NON-NLS-2$

    if (!SystemUtils.IS_OS_WINDOWS) {
        // use native LookAndFeel
        // NB: This must be after Mac-specific properties
        try {// ww  w .  ja  va 2  s .c om
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException e) {
            ErrorDialog.bug(e);
        } catch (IllegalAccessException e) {
            ErrorDialog.bug(e);
        } catch (InstantiationException e) {
            ErrorDialog.bug(e);
        } catch (UnsupportedLookAndFeelException e) {
            ErrorDialog.bug(e);
        }
    }

    // Ensure consistent behavior in NOT consuming "mousePressed" events
    // upon a JPopupMenu closing (added for Windows L&F, but others might
    // also be affected.
    UIManager.put("PopupMenu.consumeEventOnClose", Boolean.FALSE);
}

From source file:xtrememp.XtremeMP.java

public void init(String[] args) {
    // Process arguments
    Option urlOption = OptionBuilder.withArgName("URL").hasArg().withDescription("Open from URL").create("url");
    Options options = new Options();
    options.addOption("help", false, "print help information");
    options.addOption("version", false, "print the version information");
    options.addOption(urlOption);//w ww.j  a  va 2s .c om
    CommandLineParser parser = new PosixParser();
    try {
        final CommandLine line = parser.parse(options, args);
        if (line.hasOption("h") || line.hasOption("help")) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("xtrememp", options);
            System.exit(0);
        }
        if (line.hasOption("version")) {
            StringBuilder appVersion = new StringBuilder(tr("Application.title"));
            appVersion.append(" ").append(currentVersion);
            appVersion.append(" [").append(tr("Dialog.About.Codename"));
            appVersion.append(" ").append(tr("Application.version.codename"));
            appVersion.append("]");
            System.out.println(appVersion.toString());
            System.exit(0);
        }

        // Initialize JIntellitype
        if (OSUtils.IS_OS_WINDOWS) {
            String libraryLocation = (OSUtils.IS_ARCH_X64) ? "\\native\\JIntellitype64.dll"
                    : "\\native\\JIntellitype.dll";
            JIntellitype.setLibraryLocation(OSUtils.USER_DIR + libraryLocation);
            if (JIntellitype.isJIntellitypeSupported()) {
                JIntellitype.getInstance().addIntellitypeListener(this);
            }
        }

        // Initialize audio engine
        audioPlayer = new AudioPlayer();
        audioPlayer.addPlaybackListener(this);
        String mixerName = Settings.getMixerName();
        if (!Utilities.isNullOrEmpty(mixerName)) {
            audioPlayer.setMixerName(mixerName);
        }

        // Launch gui
        EventQueue.invokeLater(() -> {
            if (!OSUtils.IS_OS_WINDOWS_7 && !OSUtils.IS_OS_WINDOWS_VISTA) {
                JFrame.setDefaultLookAndFeelDecorated(true);
                JDialog.setDefaultLookAndFeelDecorated(true);
            }
            UIManager.put(SubstanceLookAndFeel.FOCUS_KIND, SubstanceConstants.FocusKind.NONE);
            SubstanceLookAndFeel.setSkin(Settings.getSkin());

            //Turn on Substance animations if required
            guiEffectsStateChanged(Settings.isUIEffectsEnabled());

            StringBuilder appTitle = new StringBuilder(tr("Application.title"));
            appTitle.append(" ").append(currentVersion);
            mainFrame = new JFrame(appTitle.toString());
            mainFrame.setIconImages(Utilities.getIconImages());

            Rectangle boundsRect = Settings.getMainFrameBounds();
            if (boundsRect.x <= 0 || boundsRect.y <= 0) {
                mainFrame.setSize(boundsRect.width, boundsRect.height);
                // Center the frame.
                mainFrame.setLocationRelativeTo(null);
            } else {
                mainFrame.setBounds(boundsRect);
            }
            mainFrame.addWindowListener(new WindowAdapter() {

                @Override
                public void windowClosing(WindowEvent ev) {
                    exit();
                }
                //                    @Override
                //                    public void windowIconified(WindowEvent e) {
                //                        if (Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.ICONIFIED)) {
                //                            getMainFrame().setExtendedState(JFrame.ICONIFIED);
                //                        }
                //                        getMainFrame().setVisible(false);
                //                    }
                //
                //                    @Override
                //                    public void windowDeiconified(WindowEvent e) {
                //                        if (Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.NORMAL)) {
                //                            getMainFrame().setExtendedState(JFrame.NORMAL);
                //                        }
                //                        getMainFrame().setVisible(true);
                //                    }
            });
            createMenuBar();
            createPanels();

            // Set a minimum size for this frame.
            mainFrame.setMinimumSize(new Dimension(532, 244));

            playlist = playlistManager.getPlaylist();
            playlist.addPlaylistListener(XtremeMP.this);

            // Restore playlist settings : play mode
            playlist.setPlayMode(Settings.getPlayMode());

            List<String> argList = Arrays.asList(line.getArgs());
            List<File> fileList = new ArrayList<>();
            if (argList.isEmpty()) {
                File playlistFile = new File(Settings.getCacheDir(), Utilities.DEFAULT_PLAYLIST);
                if (playlistFile.exists()) {
                    playlistManager.loadPlaylist(playlistFile.getAbsolutePath());
                }
            } else {
                playlistManager.setFirstLoad(true);
                if (argList.size() == 1) {
                    File file = new File(argList.get(0));
                    if (audioFileFilter.accept(file)) {
                        fileList.add(file);
                        playlistManager.addFiles(fileList, true);
                    } else if (playlistFileFilter.accept(file)) {
                        playlistManager.loadPlaylist(file.getAbsolutePath());
                    }
                } else {
                    for (String arg : argList) {
                        File file = new File(arg);
                        if (audioFileFilter.accept(file)) {
                            fileList.add(file);
                        }
                    }
                    playlistManager.addFiles(fileList, true);
                }
            }

            mainFrame.setVisible(true);
        });
    } catch (ParseException exp) {
        logger.error("Parsing failed.", exp.getMessage());
    }
}