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

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

From source file:Main.java

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

        @Override//  ww  w. ja va2  s. c om
        public void run() {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new ImagePanel("yourImage.JPG"));
            frame.pack();
            frame.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override//from www  .ja  v  a 2 s  .  c  o m
        public void run() {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new LoadImage());
            f.pack();
            f.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override/*  ww  w .  j a v  a  2s.c  o  m*/
        public void run() {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new MyPanel());
            f.pack();
            f.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override// w w w. j  av a  2s .  c om
        public void run() {
            try {
                Image img = null;
                img = ImageIO.read(new URL("http://www.java2s.com/style/download.png"));

                JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setLayout(new BorderLayout());
                frame.add(new ImagePanel(img));
                frame.pack();
                frame.setVisible(true);
            } catch (Exception exp) {
                exp.printStackTrace();
            }
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override/*  w w w.j a v  a2  s  .com*/
        public void run() {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new TestPane());
            frame.pack();
            frame.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override/* w w  w  .j  a va 2 s  . com*/
        public void run() {
            JFrame frame = new JFrame("Test");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setLayout(new BorderLayout());
            frame.add(new JScrollPane(new MyTextArea()));
            frame.pack();
            frame.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            try {
                frame.add(new MyPanel());
            } catch (Exception e) {
                e.printStackTrace();/*w  ww  .  j  a  v a2 s .com*/
            }
            frame.setSize(250, 250);
            frame.setVisible(true);
        }
    });
}

From source file:Main.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override//from ww  w.  j av a 2 s . c o m
        public void run() {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new BackgroundPane());
            frame.pack();
            frame.setVisible(true);
        }
    });
}

From source file:TimerSample.java

public static void main(String args[]) {
    Runnable runner = new Runnable() {
        public void run() {
            ActionListener actionListener = new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    System.out.println("Hello World Timer");
                }/*from  w ww.ja v  a 2  s .  c om*/
            };
            Timer timer = new Timer(500, actionListener);
            timer.start();
        }
    };
    EventQueue.invokeLater(runner);
}