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:painting.SwingPaintDemo4.java

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();/*from  w w w .  ja va 2  s.  com*/
        }
    });
}

From source file:AppPackage.HumidityGraph.java

public static void main(String args[]) {

    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new HumidityGraph().setVisible(true);
        }//from  w  w w . j  a va2s.  c om
    });
}

From source file:gtu._work.ui.RegexTestUI.java

/**
 * Auto-generated main method to display this JFrame
 *///from  ww  w. j a  v  a 2s.c o  m
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            RegexTestUI inst = new RegexTestUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:AnimationDoubleBuffering.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("Animator");

    shell.setLayout(new FillLayout());
    canvas = new Canvas(shell, SWT.NO_BACKGROUND);
    canvas.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent event) {
            // Create the image to fill the canvas
            Image image = new Image(shell.getDisplay(), canvas.getBounds());
            // Set up the offscreen gc
            GC gcImage = new GC(image);

            gcImage.setBackground(event.gc.getBackground());
            gcImage.fillRectangle(image.getBounds());
            gcImage.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_RED));
            gcImage.fillOval(x, y, IMAGE_WIDTH, IMAGE_WIDTH);

            // Draw the offscreen buffer to the screen
            event.gc.drawImage(image, 0, 0);

            image.dispose();//from  ww  w  . j ava  2s .  c  o  m
            gcImage.dispose();
        }
    });

    shell.open();
    Runnable runnable = new Runnable() {
        public void run() {
            animate();
            display.timerExec(TIMER_INTERVAL, this);
        }
    };
    display.timerExec(TIMER_INTERVAL, runnable);

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    // Kill the timer
    display.timerExec(-1, runnable);
    display.dispose();

}

From source file:gtu._work.ui.LoadJspCheckTagUI.java

/**
 * Auto-generated main method to display this JFrame
 *//* w ww  .  j  a  va  2s . c om*/
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            LoadJspCheckTagUI inst = new LoadJspCheckTagUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

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

/**
 * Launch the application./*from  w w  w  .  j av a2  s  .  c o 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:GUI.ListOfOffres1.java

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

        @Override// w w w.j  a v a2s .  com
        public void run() {
            WebLookAndFeel.install();
            WebLookAndFeel.setDecorateAllWindows(true);
            openPleaseWait();
            try {
                openListOfOffresFrame();
            } catch (IOException ex) {
                Logger.getLogger(ListOfOffres1.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

From source file:gtu._work.ui.DownloadMoveUI.java

/**
* Auto-generated main method to display this JFrame
*///  w ww .j  a  v a 2 s.  c o  m
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            DownloadMoveUI inst = new DownloadMoveUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:com.senseidb.search.node.inmemory.InMemoryIndexPerfEval.java

public static void main(String[] args) throws Exception {
    final InMemorySenseiService memorySenseiService = InMemorySenseiService.valueOf(
            new File(InMemoryIndexPerfEval.class.getClassLoader().getResource("test-conf/node1/").toURI()));

    final List<JSONObject> docs = new ArrayList<JSONObject>(15000);
    LineIterator lineIterator = FileUtils.lineIterator(
            new File(InMemoryIndexPerfEval.class.getClassLoader().getResource("data/test_data.json").toURI()));
    int i = 0;// www.  j  av  a  2 s.  com
    while (lineIterator.hasNext() && i < 100) {
        String car = lineIterator.next();
        if (car != null && car.contains("{"))
            docs.add(new JSONObject(car));
        i++;
    }
    Thread[] threads = new Thread[10];
    for (int k = 0; k < threads.length; k++) {
        threads[k] = new Thread(new Runnable() {
            public void run() {
                long time = System.currentTimeMillis();
                //System.out.println("Start thread");
                for (int j = 0; j < 1000; j++) {
                    //System.out.println("Send request");
                    memorySenseiService.doQuery(getRequest(), docs);
                }
                System.out.println("time = " + (System.currentTimeMillis() - time));
            }
        });
        threads[k].start();
    }
    Thread.sleep(500000);
}

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

public static void main(String[] args) {
    setLookAndFeel();//  w ww. j  a v  a 2s .c om
    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();
            }
        }
    });
}