Example usage for java.awt EventQueue invokeLater

List of usage examples for java.awt EventQueue invokeLater

Introduction

In this page you can find the example usage for java.awt EventQueue invokeLater.

Prototype

public static void invokeLater(Runnable runnable) 

Source Link

Document

Causes runnable to have its run method called in the #isDispatchThread dispatch thread of Toolkit#getSystemEventQueue the system EventQueue .

Usage

From source file:BookTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new BookTestFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from   w w  w . j  ava2 s  .c o  m*/
        }
    });
}

From source file:view.VideoSubscriberGUI.java

/**
 * Launch the application./*  w w w  .ja va2s.  c  o  m*/
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                VideoSubscriberGUI window = new VideoSubscriberGUI();
                window.frmBlackvidPubsubber.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:de.atomfrede.tools.evalutation.ui.AppWindow.java

/**
 * Launch the application.//from   ww w.  j  a  v a 2s.  c  om
 */
public static void main(String[] args) {

    setLookAndFeel();
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                JarUtil.startFileLogging();
                SingleInstance.lock();
                AppWindow window = new AppWindow();
                window.frame.setVisible(true);
            } catch (OverlappingFileLockException lock) {
                DialogUtil.getInstance().showErrorDialog("Lock Exception",
                        "<html><b>A lock is already set.</b><br>Make sure no other instance of Plant Evaluation is running and restart the application.</html>");
                System.exit(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:JFrameDemoSafe.java

public static void main(String[] args) {

    // Create the GUI (variable is final because used by inner class).
    final JFrame demo = new JFrameDemo();

    // Create a Runnable to set the main visible, and get Swing to invoke.
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            demo.setVisible(true);//from  w ww. jav  a  2 s.co  m
        }
    });
}

From source file:LicenseGenerator.java

/**
 * Launch the application./* www .  j av  a 2  s .  c o  m*/
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                LicenseGenerator window = new LicenseGenerator();
                window.m_frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:XMLWriteTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            XMLWriteFrame frame = new XMLWriteFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*from w  w  w . jav  a2 s . c o m*/
        }
    });
}

From source file:net.jingx.main.Main.java

/**
 * @param args/* ww  w. j  ava  2 s. c  o  m*/
 * @throws IOException 
 */
public static void main(String[] args) {
    CommandLineParser parser = new PosixParser();
    Options options = new Options();
    options.addOption(CLI_SECRET, true, "generate secret key (input is the configuration key from google)");
    options.addOption(CLI_PASSCODE, true, "generate passcode (input is the secret key)");
    options.addOption(new Option(CLI_HELP, "print this message"));
    try {
        CommandLine line = parser.parse(options, args);
        if (line.hasOption(CLI_SECRET)) {
            String confKey = line.getOptionValue(CLI_SECRET);
            String secret = generateSecret(confKey);
            System.out.println("Your secret to generate pins: " + secret);
        } else if (line.hasOption(CLI_PASSCODE)) {
            String secret = line.getOptionValue(CLI_PASSCODE);
            String pin = computePin(secret, null);
            System.out.println(pin);
        } else if (line.hasOption(CLI_HELP)) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("GAuthCli", options);
        } else {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        MainGui window = new MainGui();
                        window.doSetVisible();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            return;
        }
        System.out.println("Press any key to exit");
        System.in.read();
    } catch (Exception e) {
        System.out.println("Unexpected exception:" + e.getMessage());
    }
    System.exit(0);
}

From source file:org.rivalry.swingui.RivalryUI.java

/**
 * Application method.//from   w  w  w  .j a v  a2s.  com
 *
 * @param args Application arguments.
 */
public static final void main(final String[] args) {
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Rivalry UI");
    System.out.println("Applying look and feel: " + _uiUserPreferences.getLookAndFeel().getName());
    _uiUserPreferences.getLookAndFeel().apply();

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            final RivalryUI panel = new RivalryUI();

            _frame = new JFrame("Rivalry UI");
            _frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            _frame.getContentPane().add(panel, BorderLayout.CENTER);
            _frame.setSize(1900, 600);
            _frame.setLocationByPlatform(true);
            _frame.setVisible(true);
        }
    });
}

From source file:view.VideoPublisherGUI.java

/**
 * Launch the application./* w  w w  .  jav  a 2  s .co  m*/
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                VideoPublisherGUI window = new VideoPublisherGUI();
                window.frmBlackvidPubsubber.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:tarea1.histogram.java

public static void main(String[] args) {
    EventQueue.invokeLater(() -> {
        new histogram().display();
    });
}