Example usage for java.lang Runnable Runnable

List of usage examples for java.lang Runnable Runnable

Introduction

In this page you can find the example usage for java.lang Runnable Runnable.

Prototype

Runnable

Source Link

Usage

From source file:SplitPaneTest.java

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

From source file:ColorChooserTest.java

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

From source file:TextComponentTest.java

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

From source file:musite.MusiteMain.java

/**
* @param args the command line arguments
*///from   w  w  w.  j  a v  a  2  s  .c  o m
public static void main(String[] args) {
    init();

    if (args.length == 0) {
        // gui mode
        setupLookAndFeel();

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Musite.getDesktop().setVisible(true);
            }
        });
    } else {
        if (args[0].equalsIgnoreCase("list-model")) {
            CmdLineTools.listModelCmd();
        } else if (args[0].equalsIgnoreCase("predict")) {
            try {
                CmdLineTools.predictCmd(Arrays.copyOfRange(args, 1, args.length));
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        } else {
            System.err.println("Unsupported command");
            System.exit(1);
        }
    }
}

From source file:MouseTest.java

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

From source file:ProgressMonitorTest.java

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

From source file:com.usefullc.solm.common.proxy.nio.NIOSocketServer.java

public static void main(String[] args) {
    try {// ww  w  .ja v a 2 s  . c  o m
        //proxy connect pool
        System.setProperty("htmlDir", args[0]);
        int port = Integer.valueOf(args[1]);
        ServerMgr.init(port);
        //end

        System.out.println("htmlDir=" + args[0]);
        System.out.println("port=" + args[1]);

        ProxyTaskExecutor.start(); //?

        new Thread(new Runnable() {
            @Override
            public void run() {
                ServerMgr.startServer();

                //                    ReadHandler.start();  //?browser req and server res ?
            }
        }).start();

        System.out.println("server is start at " + ServerMgr.getPort());

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ProgressBarUpdateAnotherThread.java

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    final ProgressBar bar = new ProgressBar(shell, SWT.SMOOTH);
    bar.setBounds(10, 10, 200, 32);//from   w w  w  .j  a va 2  s.  c o m
    shell.open();
    final int maximum = bar.getMaximum();
    new Thread() {
        public void run() {
            for (final int[] i = new int[1]; i[0] <= maximum; i[0]++) {
                try {
                    Thread.sleep(100);
                } catch (Throwable th) {
                }
                if (display.isDisposed())
                    return;
                display.asyncExec(new Runnable() {
                    public void run() {
                        if (bar.isDisposed())
                            return;
                        bar.setSelection(i[0]);
                    }
                });
            }
        }
    }.start();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:TestPipes.java

public static void main(String[] args) throws Exception {
    final PipedOutputStream pos = new PipedOutputStream();

    final PipedInputStream pis = new PipedInputStream(pos);

    Runnable runOutput = new Runnable() {
        public void run() {
            writeData(pos);//w  ww  . java  2  s. co  m
        }
    };

    Thread outThread = new Thread(runOutput, "outThread");
    outThread.start();

    Runnable runInput = new Runnable() {
        public void run() {
            readData(pis);
        }
    };

    Thread inThread = new Thread(runInput, "inThread");
    inThread.start();
}

From source file:LongListTest.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new LongListFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);/*  w  w w .  jav  a2s.com*/
        }
    });
}