List of usage examples for java.lang Runnable Runnable
Runnable
From source file:TableDemoApplet.java
public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(3); createGUI(frame.getContentPane()); frame.pack();//from ww w. j a va 2s.c o m frame.setVisible(true); } }); }
From source file:Bounce.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new BounceFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from w w w. ja v a2s .co m } }); }
From source file:TreeEditTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new TreeEditFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*ww w .j av a 2 s. c om*/ } }); }
From source file:gtu._work.ui.JermyP100UI.java
/** * Auto-generated main method to display this JFrame *//*w w w. ja v a 2 s. c om*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JermyP100UI inst = new JermyP100UI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:EventTracerTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new EventTracerFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*from ww w . j a v a 2 s . c o m*/ } }); }
From source file:cl.bbr.servicemix.ServiceMixEmbebbed.Main.java
/** * @param args/*from w ww . j a v a2s . c o m*/ */ public static void main(String[] args) { // This is a very simple example of how you might embed ServiceMix try { final ApplicationContext context = new ClassPathXmlApplicationContext("context-jbi.xml"); SpringJBIContainer container = (SpringJBIContainer) context.getBean("jbi"); container.onShutDown(new Runnable() { public void run() { if (context instanceof DisposableBean) { try { ((DisposableBean) context).destroy(); } catch (Exception e) { System.out.println("Caught: " + e); e.printStackTrace(); } } } }); } catch (Exception e) { System.out.println("Caught: " + e); e.printStackTrace(); } }
From source file:QueryDB.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() {//from w w w.j a v a2 s. c o m public void run() { JFrame frame = new QueryDBFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); }
From source file:org.eclipse.swt.snippets.Snippet68.java
public static void main(String[] args) { final Display display = new Display(); final Color red = display.getSystemColor(SWT.COLOR_RED); final Color blue = display.getSystemColor(SWT.COLOR_BLUE); Shell shell = new Shell(display); shell.setText("Snippet 68"); shell.setLayout(new RowLayout()); Button button = new Button(shell, SWT.PUSH); button.setText("Stop Timer"); final Label label = new Label(shell, SWT.BORDER); label.setBackground(red);// www. j a v a 2 s .c om final int time = 500; final Runnable timer = new Runnable() { @Override public void run() { if (label.isDisposed()) return; Color color = label.getBackground().equals(red) ? blue : red; label.setBackground(color); display.timerExec(time, this); } }; display.timerExec(time, timer); button.addListener(SWT.Selection, event -> display.timerExec(-1, timer)); button.pack(); label.setLayoutData(new RowData(button.getSize())); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TableFillThread.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Lazy Table"); shell.setLayout(new FillLayout()); final Table table = new Table(shell, SWT.BORDER | SWT.MULTI); table.setSize(200, 200);//from w w w .java 2 s .c om Thread thread = new Thread() { public void run() { for (int i = 0; i < 20000; i++) { final int[] index = new int[] { i }; display.syncExec(new Runnable() { public void run() { if (table.isDisposed()) return; TableItem item = new TableItem(table, SWT.NONE); item.setText("Table Item " + index[0]); } }); } } }; thread.start(); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:AlgorithmAnimation.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new AnimationFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*from w w w . j a v a2s . co m*/ } }); }