Example usage for javax.swing JFrame setDefaultLookAndFeelDecorated

List of usage examples for javax.swing JFrame setDefaultLookAndFeelDecorated

Introduction

In this page you can find the example usage for javax.swing JFrame setDefaultLookAndFeelDecorated.

Prototype

public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated) 

Source Link

Document

Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel.

Usage

From source file:se.nawroth.asciidoc.browser.AsciidocBrowserApplication.java

public static void main(final String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override/*from   w w w .  ja va  2s  .  c om*/
        public void run() {
            try {
                JFrame.setDefaultLookAndFeelDecorated(true);
                JDialog.setDefaultLookAndFeelDecorated(true);
                System.setProperty("sun.awt.noerasebackground", "true");
                UIManager.setLookAndFeel(new AsciidocBrowserSubstanceSkin());
                AsciidocBrowserApplication browser = new AsciidocBrowserApplication(args);
                browser.setVisible(true);
                settingsDialog = new SettingsDialog();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:us.paulevans.basicxslt.BasicXSLTFrame.java

/**
 * class main() method - application entry point
 * @param aArgs/* ww  w .  j  a v  a 2s  .  com*/
 */
public static void main(String aArgs[]) throws Exception {
    JFrame.setDefaultLookAndFeelDecorated(true);
    new BasicXSLTFrame();
}

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 w  w  . j  a  v a2s  .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());
    }
}