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:LoggerGUI.MainFrame.java

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {

            /*JFrame frame = new JFrame("Charts");
                    /*from  w ww.j  ava  2 s.c  om*/
            frame.setSize(700, 400);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
                */

            DataLogger demo = new DataLogger("DemoUI", 51);

            Container contentPane = demo.getContentPane();

            demo.pack();

            demo.setVisible(true);
            demo.setSize(100, 100);

            demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            demo.setVisible(true);

            XYDataset ds = createDataset();
            JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "x", "y", ds,
                    PlotOrientation.HORIZONTAL, true, true, false);

            ChartPanel cp = new ChartPanel(chart);

            //cp.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
            //contentPane.add(cp, BorderLayout.EAST);

            //cp.setSize(100,100);

            //RefineryUtilities.centerFrameOnScreen(demo);

            demo.pack();

        }
    });

}

From source file:org.eclipse.swt.snippets.Snippet275.java

public static void main(String[] args) {
    final int INTERVAL = 888;
    final Display display = new Display();
    final Image image = new Image(display, 750, 750);
    GC gc = new GC(image);
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
    gc.fillRectangle(image.getBounds());
    gc.dispose();//from   w  ww  .ja va 2 s .c om

    Shell shell = new Shell(display);
    shell.setText("Snippet 275");
    shell.setBounds(10, 10, 790, 790);
    final Canvas canvas = new Canvas(shell, SWT.NONE);
    canvas.setBounds(10, 10, 750, 750);
    canvas.addListener(SWT.Paint, event -> {
        value = String.valueOf(System.currentTimeMillis());
        event.gc.drawImage(image, 0, 0);
        event.gc.drawString(value, 10, 10, true);
    });
    display.timerExec(INTERVAL, new Runnable() {
        @Override
        public void run() {
            if (canvas.isDisposed())
                return;
            // canvas.redraw (); // <-- bad, damages more than is needed
            GC gc = new GC(canvas);
            Point extent = gc.stringExtent(value + '0');
            gc.dispose();
            canvas.redraw(10, 10, extent.x, extent.y, false);
            display.timerExec(INTERVAL, this);
        }
    });
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    image.dispose();
    display.dispose();
}

From source file:com.qubole.rubix.bookkeeper.BookKeeperServer.java

public static void main(String[] args) {
    conf = new Configuration();

    Runnable bookKeeperServer = new Runnable() {
        public void run() {
            startServer(conf);/*from  w  ww  . j  av  a  2s  .co  m*/
        }
    };

    new Thread(bookKeeperServer).run();
}

From source file:gtu._work.etc.SqlReplacerUI.java

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

From source file:painting.SwingPaintDemo1.java

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();//from www.j  a v a  2 s .  com
        }
    });
}

From source file:SwingWorkerTest.java

public static void main(String[] args) throws Exception {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new SwingWorkerFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);//from  www  .j ava2 s.c om
        }
    });
}

From source file:Wallpaper.java

public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createUI();//from  w w  w . j a va  2 s . c  o  m
        }
    });
}

From source file:OptionDialogTest.java

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

From source file:StrokeTest.java

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

From source file:CompositeTest.java

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