Example usage for javax.swing SwingUtilities invokeLater

List of usage examples for javax.swing SwingUtilities invokeLater

Introduction

In this page you can find the example usage for javax.swing SwingUtilities invokeLater.

Prototype

public static void invokeLater(Runnable doRun) 

Source Link

Document

Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.

Usage

From source file:misc.TablePrintDemo3.java

/**
 * Start the application./*  www . j  a  va 2  s  .  c  om*/
 */
public static void main(final String[] args) {
    /* Schedule for the GUI to be created and shown on the EDT */
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            /* Don't want bold fonts if we end up using metal */
            UIManager.put("swing.boldMetal", false);
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
            }
            new TablePrintDemo3().setVisible(true);
        }
    });
}

From source file:com.raddle.tools.MergeMain.java

/**
 * Auto-generated main method to display this JFrame
 *//*from   w  ww  .  j a  va 2 s .c o  m*/
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            MergeMain inst = new MergeMain();
            inst.setDefaultCloseOperation(EXIT_ON_CLOSE);
            inst.setBounds(200, 200, 1050, 600);
            inst.setVisible(true);
        }
    });
}

From source file:com.haulmont.cuba.desktop.App.java

public static void main(final String[] args) {
    SwingUtilities.invokeLater(() -> {
        app = new App();
        app.init(args);/*from   w w  w.  java2 s  .  c  om*/
        app.show();
        app.showLoginDialog();
    });
}

From source file:com.thesmartguild.firmloader.app.LoaderUserDisplay.java

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new LoaderUserDisplay("TEST");
        }/* www. j  a  va2 s  .  c  o  m*/
    });

}

From source file:dnd.ChooseDropActionDemo.java

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            createAndShowGUI();//from   www  .java  2 s. co m
        }
    });
}

From source file:ColorDifference.java

/**
 * @param args/*  w w w. ja  va 2 s.  c  om*/
 *          the command line arguments
 */
public static void main(String[] args) {
    Runnable doCreateAndShowGUI = new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    };
    SwingUtilities.invokeLater(doCreateAndShowGUI);
}

From source file:DataBufferGrabber.java

public static void main(String args[]) {
    Runnable doCreateAndShowGUI = new Runnable() {
        public void run() {
            createAndShowGUI();/*from  w ww .  ja va2s  . c  o  m*/
        }
    };
    SwingUtilities.invokeLater(doCreateAndShowGUI);
}

From source file:de.mpi_bremen.mgg.FastaValidatorUi.java

/**
 * @param args the command line arguments
 *///from   ww  w . j a v  a  2s.c om
public static void main(String[] args) {
    // create Options object
    Options options = new Options();
    // add verbose option
    options.addOption("v", "verbose", false, "verbose mode");
    // add inputfile option
    options.addOption("f", "file", true, "FASTA-formatted input file");
    // add help option
    options.addOption("h", "help", false, "print this help message");
    // add sequencetype option
    options.addOption("t", "seqtype", true, "sequence type (allowed values: all|dna|rna|protein)");
    // add gui-mode option
    options.addOption("nogui", false, "start in non-interactive mode");

    //create the cmdline-parser   
    GnuParser parser = new GnuParser();

    // parse the command line arguments
    try {
        //get cmdline arguments
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println(exp.getMessage());
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("FastaValidatorUi", options, true);
        System.exit(1); //indicate error to external environment
    }

    if (cmdline.hasOption("h")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("FastaValidatorUi", options, true);
        System.exit(0); //indicate no errors to external environment
    }

    //which mode? (gui or cmdline)
    if (cmdline.hasOption("nogui")) { //cmdline-mode

        //create new cmdline-gui
        FvCmdline cmdlinegui = new FvCmdline();

        //set verbosity
        cmdlinegui.setVerbose(cmdline.hasOption("v"));

        //handle input file
        if (cmdline.hasOption("f")) {
            cmdlinegui.setInput(cmdline.getOptionValue("f"));
        }

        //set sequencetype
        if (cmdline.hasOption("t")) {
            cmdlinegui.setSequencetype(getSeqtype(cmdline.getOptionValue("t")));
        } else {
            cmdlinegui.setSequencetype(FastaValidator.Sequencetype.ALL);
        }

        //trigger validation and exit with exitcode
        int exitcode = cmdlinegui.validate().getValue();
        System.exit(exitcode);

    } else { //gui-mode
        //start gui in its own thread
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                FvGui w = new FvGui();
            }
        });
    }
}

From source file:SourceInDemo.java

public static void main(String... args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new SourceInDemo().setVisible(true);
        }//w w  w. j a va  2  s.  com
    });
}

From source file:misc.DesktopDemo.java

public static void main(String args[]) {
    /* Use an appropriate Look and Feel */
    try {/*w w w. j  av  a2  s  . c om*/
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    }
    /* Turn off metal's use of bold fonts */
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new DesktopDemo().setVisible(true);
        }
    });
}