List of usage examples for java.lang Runnable Runnable
Runnable
From source file:gtu._work.ui._DefaultJFrameUI.java
/** * Auto-generated main method to display this JFrame *//*from w w w . ja v a 2 s . c o m*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { _DefaultJFrameUI inst = new _DefaultJFrameUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:SerialTransferTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new SerialTransferFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from w w w . ja v a 2 s.c om } }); }
From source file:InterruptibleSocketTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new InterruptibleSocketFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*from ww w . j a v a 2 s.c o m*/ } }); }
From source file:PipedBytes.java
public static void main(String[] args) { try {/* w ww.j ava 2s .c o m*/ final PipedOutputStream out = new PipedOutputStream(); final PipedInputStream in = new PipedInputStream(out); Runnable runA = new Runnable() { public void run() { writeStuff(out); } }; Thread threadA = new Thread(runA, "threadA"); threadA.start(); Runnable runB = new Runnable() { public void run() { readStuff(in); } }; Thread threadB = new Thread(runB, "threadB"); threadB.start(); } catch (IOException x) { x.printStackTrace(); } }
From source file:org.eclipse.swt.snippets.Snippet130.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Snippet 130"); shell.setLayout(new GridLayout()); final Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); text.setLayoutData(new GridData(GridData.FILL_BOTH)); final int[] nextId = new int[1]; Button b = new Button(shell, SWT.PUSH); b.setText("invoke long running job"); b.addSelectionListener(widgetSelectedAdapter(e -> { Runnable longJob = new Runnable() { boolean done = false; int id; @Override/*from w ww . ja v a2s . c o m*/ public void run() { Thread thread = new Thread(() -> { id = nextId[0]++; display.syncExec(() -> { if (text.isDisposed()) return; text.append("\nStart long running task " + id); }); for (int i = 0; i < 100000; i++) { if (display.isDisposed()) return; System.out.println("do task that takes a long time in a separate thread " + id); } if (display.isDisposed()) return; display.syncExec(() -> { if (text.isDisposed()) return; text.append("\nCompleted long running task " + id); }); done = true; display.wake(); }); thread.start(); while (!done && !shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }; BusyIndicator.showWhile(display, longJob); })); shell.setSize(250, 150); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:gtu.db.sqlMaker.DbSqlCreaterUI.java
/** * Auto-generated main method to display this JFrame *//*w w w. j av a 2s . com*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { DbSqlCreaterUI inst = new DbSqlCreaterUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:com.alibaba.dubbo.examples.async.AsyncConsumer.java
public static void main(String[] args) throws Exception { String config = AsyncConsumer.class.getPackage().getName().replace('.', '/') + "/async-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();// w w w . jav a 2s . c o m final AsyncService asyncService = (AsyncService) context.getBean("asyncService"); Future<String> f = RpcContext.getContext().asyncCall(new Callable<String>() { public String call() throws Exception { return asyncService.sayHello("async call request"); } }); System.out.println("async call ret :" + f.get()); RpcContext.getContext().asyncCall(new Runnable() { public void run() { asyncService.sayHello("oneway call request1"); asyncService.sayHello("oneway call request2"); } }); System.in.read(); }
From source file:DataExchangeTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { DataExchangeFrame frame = new DataExchangeFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from w w w . j a v a 2 s. co m } }); }
From source file:nh.examples.springintegration.order.client.OrderClient.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/client-swing-ctx.xml"); _logger.info(" Main gestartet "); ClientContext.createInstance(context); SwingUtilities.invokeLater(new Runnable() { public void run() { setLnF();//from www .j a v a2 s . c o m EventViewDialog.openEventViewDialog(); OrderOverviewModel model = new OrderOverviewModel(); OrderOverviewView view = new OrderOverviewView(model); OrderOverviewController controller = new OrderOverviewController(view); DefaultApplicationDialog dialog = new DefaultApplicationDialog("Order Overview", view, controller); dialog.open(); } }); }
From source file:FileChooserTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { ImageViewerFrame frame = new ImageViewerFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);// w ww .j av a 2 s .com } }); }