Java EventQueue .invokeLater (Runnable runnable)
Syntax
EventQueue.invokeLater(Runnable runnable) has the following syntax.
public static void invokeLater(Runnable runnable)
Example
In the following code shows how to use EventQueue.invokeLater(Runnable runnable) method.
// w ww . j a v a 2 s . c o m
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Main {
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);
}
});
}
}
class ImageProcessingFrame extends JFrame
{
public ImageProcessingFrame()
{
setTitle("ImageProcessingTest");
setSize(200, 200);
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »