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:erigo.filepump.FilePump.java

private void createAndShowGUI(String default_outputFolderI, double default_filesPerSecI,
        int default_totNumFilesI, FileMode default_modeI, String default_ftpHostI, String default_ftpUserI,
        String default_ftpPasswordI) {

    // Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create the GUI components
    GridBagLayout framegbl = new GridBagLayout();
    filePumpGuiFrame = new JFrame("FilePump");
    GridBagLayout gbl = new GridBagLayout();
    JPanel guiPanel = new JPanel(gbl);
    outputFolderLabel = new JLabel(" ");
    Dimension preferredSize = new Dimension(200, 20);
    outputFolderLabel.setPreferredSize(preferredSize);
    filesPerSecLabel = new JLabel("1");
    totNumFilesLabel = new JLabel("unlimited");
    modeLabel = new JLabel("file system folder");
    fileCountLabel = new JLabel("0");
    endButton = new JButton("Finish test");
    endButton.addActionListener(this);
    actionButton = new JButton("Start pump");
    actionButton.setBackground(Color.GREEN);
    actionButton.addActionListener(this);

    filePumpGuiFrame.setFont(new Font("Dialog", Font.PLAIN, 12));
    guiPanel.setFont(new Font("Dialog", Font.PLAIN, 12));

    int row = 0;//w  ww .  j a v a  2  s  .c  om

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;

    // ROW 1
    JLabel label = new JLabel("Output directory");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, outputFolderLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 2
    label = new JLabel("Files/sec");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, filesPerSecLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 3
    label = new JLabel("Tot num files");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, totNumFilesLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 4
    label = new JLabel("Mode");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, modeLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 5
    label = new JLabel("File count");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, fileCountLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 6: command buttons
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(actionButton);
    buttonPanel.add(endButton);
    gbc.insets = new Insets(15, 15, 15, 15);
    gbc.anchor = GridBagConstraints.CENTER;
    Utility.add(guiPanel, buttonPanel, gbl, gbc, 0, row, 2, 1);
    gbc.anchor = GridBagConstraints.WEST;
    ++row;

    // Now add guiPanel to filePumpGuiFrame
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 100;
    gbc.weighty = 100;
    gbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(filePumpGuiFrame, guiPanel, framegbl, gbc, 0, 0, 1, 1);

    // Add menu
    JMenuBar menuBar = createMenu();
    filePumpGuiFrame.setJMenuBar(menuBar);

    // Display the window.
    filePumpGuiFrame.pack();

    filePumpGuiFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    filePumpGuiFrame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            exit();
        }
    });

    // Create a settings dialog box
    pumpSettings = new FilePumpSettings(filePumpGuiFrame, default_outputFolderI, default_filesPerSecI,
            default_totNumFilesI, default_modeI, default_ftpHostI, default_ftpUserI, default_ftpPasswordI);

    // Initialize information displayed on the GUI front panel
    updateMainFrame();

    filePumpGuiFrame.setVisible(true);

}

From source file:com.ficeto.esp.EspExceptionDecoder.java

private void createAndUpload() {
    if (!PreferencesData.get("target_platform").contentEquals("esp8266")
            && !PreferencesData.get("target_platform").contentEquals("esp32")
            && !PreferencesData.get("target_platform").contentEquals("ESP31B")) {
        System.err.println();//  w w  w  .  ja va 2 s .com
        editor.statusError("Not Supported on " + PreferencesData.get("target_platform"));
        return;
    }

    String tc = "esp32";
    if (PreferencesData.get("target_platform").contentEquals("esp8266")) {
        tc = "lx106";
    }

    TargetPlatform platform = BaseNoGui.getTargetPlatform();

    String gccPath = PreferencesData.get("runtime.tools.xtensa-" + tc + "-elf-gcc.path");
    if (gccPath == null) {
        gccPath = platform.getFolder() + "/tools/xtensa-" + tc + "-elf";
    }

    String addr2line;
    if (PreferencesData.get("runtime.os").contentEquals("windows"))
        addr2line = "xtensa-" + tc + "-elf-addr2line.exe";
    else
        addr2line = "xtensa-" + tc + "-elf-addr2line";

    tool = new File(gccPath + "/bin", addr2line);
    if (!tool.exists() || !tool.isFile()) {
        System.err.println();
        editor.statusError("ERROR: " + addr2line + " not found!");
        return;
    }

    elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".ino.elf");
    if (!elf.exists() || !elf.isFile()) {
        elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".cpp.elf");
        if (!elf.exists() || !elf.isFile()) {
            //lets give the user a chance to select the elf
            final JFileChooser fc = new JFileChooser();
            fc.addChoosableFileFilter(new ElfFilter());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showDialog(editor, "Select ELF");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                elf = fc.getSelectedFile();
            } else {
                editor.statusError("ERROR: elf was not found!");
                System.err.println("Open command cancelled by user.");
                return;
            }
        }
    }

    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame("Exception Decoder");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    inputArea = new JTextArea("Paste your stack trace here", 16, 60);
    inputArea.setLineWrap(true);
    inputArea.setWrapStyleWord(true);
    inputArea.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "commit");
    inputArea.getActionMap().put("commit", new CommitAction());
    inputArea.getDocument().addDocumentListener(this);
    frame.getContentPane().add(new JScrollPane(inputArea), BorderLayout.PAGE_START);

    outputText = "";
    outputArea = new JTextPane();
    outputArea.setContentType("text/html");
    outputArea.setEditable(false);
    outputArea.setBackground(null);
    outputArea.setBorder(null);
    outputArea.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
    outputArea.setText(outputText);

    JScrollPane outputScrollPane = new JScrollPane(outputArea);
    outputScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    outputScrollPane.setPreferredSize(new Dimension(640, 200));
    outputScrollPane.setMinimumSize(new Dimension(10, 10));
    frame.getContentPane().add(outputScrollPane, BorderLayout.CENTER);

    frame.pack();
    frame.setVisible(true);
}

From source file:InputVerificationDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */// ww  w  . ja  va 2 s .  c  o  m
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("InputVerificationDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new InputVerificationDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *//*from  ww  w . j  av  a2s . co  m*/
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("ListDataEventDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Don't let the content pane get too small.
    //(Works if the Java look and feel provides
    //the window decorations.)
    newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100));

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:TextSamplerDemo.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///from   w  w  w.  j a  v a  2 s .c  om
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("TextSamplerDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new TextSamplerDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Load the deck builder from the command line.
 * /*from w w w. j  ava2 s .com*/
 * @param args
 *          the command line arguments
 */
public static void main(String[] args) {
    consoleMode = true;
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    autoLoad();
}

From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java

private static void showTestUI() {

    // Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create and set up the window.
    JFrame frame = new JFrame("Db4oSyncSourceConfigPanel Test Harness");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    final Db4oSyncSource source = new Db4oSyncSource();
    Db4oSyncSourceConfigPanel p = new Db4oSyncSourceConfigPanel();
    p.setManagementObject(new SyncSourceManagementObject(source, null, null, null, null));
    p.updateForm();// ww w .  ja  va  2 s.  co  m
    p.setOpaque(true); // content panes must be opaque
    frame.setContentPane(p);

    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent ev) {

            XMLEncoder encoder = null;
            try {
                FileOutputStream s = new FileOutputStream("test.xml");
                encoder = new XMLEncoder(s);
                encoder.setExceptionListener(new ExceptionListener() {
                    public void exceptionThrown(Exception exception) {
                        exception.printStackTrace();
                    }
                });
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                System.exit(-1);
            }
            encoder.writeObject((Object) source);
            encoder.flush();
            encoder.close();

        }

    });

    // Display the window.
    frame.pack();
    frame.setVisible(true);

}

From source file:fedroot.dacs.swingdemo.DacsClientFrame.java

/**
 * Create and display the DACS Login Frame.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from   w w  w.j  av a  2 s . c  o  m
 */
private void createAndShowLoginFrame() {
    // use the tiddly window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create and set up the window.
    DacsLoginFrame loginFrame = new DacsLoginFrame(this.federation, this.dacsClientContext);
    loginFrame.setSize(750, 200);
    loginFrame.setVisible(true);
}

From source file:fedroot.dacs.swingdemo.DacsClientFrame.java

/**
 * Create and display the DACS Username Frame.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from   ww  w .  j a  v a  2s .  com
 */
private void createAndShowDacsUsernameFrame() {
    // use the tiddly window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create and set up the window.
    DacsUsernameFrame signoutFrame = new DacsUsernameFrame(this.dacsClientContext);
    signoutFrame.setSize(750, 200);
    signoutFrame.setVisible(true);
}

From source file:it.ldp.pingscheduler.PingSchedulerGUI.java

/**
 * @param args//from w  w w .j a v a 2  s  . c  o  m
 *            the command line arguments
 */
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 {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(PingSchedulerGUI.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(PingSchedulerGUI.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(PingSchedulerGUI.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(PingSchedulerGUI.class.getName()).log(java.util.logging.Level.SEVERE,
                null, ex);
    }
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>
    // </editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new PingSchedulerGUI().setVisible(true);
            JFrame.setDefaultLookAndFeelDecorated(true);
            UIManager.put("JFrame.activeTitleBackground", Color.red);

        }
    });
}