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:TableCellRenderTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {

            JFrame frame = new TableCellRenderFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//from www.ja va2s . c o m
        }
    });
}

From source file:dpcs.About.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                About frame = new About();
                frame.setVisible(true);//  w  w  w.  ja v  a  2 s .  c o m
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:ClassTree.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new ClassTreeFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//from   w  w  w .  j a v  a 2  s.  co m
        }
    });
}

From source file:dpcs.UninstallPrivApps.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                UninstallPrivApps frame = new UninstallPrivApps();
                frame.setVisible(true);//from  w w w .  jav a2 s.c om
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:dpcs.UninstallSystemApps.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                UninstallSystemApps frame = new UninstallSystemApps();
                frame.setVisible(true);/*from   w w w  .j a v a 2  s  .  c  o  m*/
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:dpcs.UninstallUserApps.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                UninstallUserApps frame = new UninstallUserApps();
                frame.setVisible(true);//  ww w. j  ava2  s.c o  m
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:updater.UpdaterGUI.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                UpdaterGUI frame = new UpdaterGUI();
                frame.setVisible(true);/* www .ja  v  a 2s .  c  o m*/
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:com.smart.aqimonitor.client.AqiMonitor.java

/**
 * Launch the application.//from   w w  w. j  a v  a  2 s  . co m
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                AqiMonitor frame = new AqiMonitor();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:PropertyChangeListenerDemo.java

public static void main(String args[]) {
    Runnable runner = new Runnable() {
        public void run() {
            JFrame frame = new JFrame("Button Sample");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            final JButton button1 = new JButton("Select Me");
            final JButton button2 = new JButton("No Select Me");
            final Random random = new Random();
            // Define ActionListener
            ActionListener actionListener = new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    JButton button = (JButton) actionEvent.getSource();
                    int red = random.nextInt(255);
                    int green = random.nextInt(255);
                    int blue = random.nextInt(255);
                    button.setBackground(new Color(red, green, blue));
                }/*from  w w  w  . j a v  a 2 s .  co  m*/
            };
            // Define PropertyChangeListener
            PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
                    String property = propertyChangeEvent.getPropertyName();
                    if ("background".equals(property)) {
                        button2.setBackground((Color) propertyChangeEvent.getNewValue());
                    }
                }
            };
            button1.addActionListener(actionListener);
            button1.addPropertyChangeListener(propertyChangeListener);
            button2.addActionListener(actionListener);
            frame.add(button1, BorderLayout.NORTH);
            frame.add(button2, BorderLayout.SOUTH);
            frame.setSize(300, 100);
            frame.setVisible(true);
        }
    };
    EventQueue.invokeLater(runner);
}

From source file:de.peterspan.csv2db.AppWindow.java

public static void main(String[] args) {
    setLookAndFeel();//from ww w  . j a  va 2 s.c o  m
    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 csv2DB is running and restart the application.</html>");
                System.exit(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}