public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.PUSH); button.setText("Press me to test responsiveness"); shell.pack(); shell.open(); display.timerExec(1000, new Runnable() { public void run() { System.out.println("Time: " + System.currentTimeMillis()); display.timerExec(1000, this); } }); Thread thread = new Thread() { public void run() { System.out.println("Running thread."); double result = 0.0; long last = System.currentTimeMillis(); for(int i = 0; i < 99999999; i++) { double think = 5 + (double) i; int harder = (int) Math.cos(think); double foo = Math.sin((double)harder) * Math.sqrt(think); result += foo; if (i % 100000 == 0) { long cur = System.currentTimeMillis(); System.out.println("Hello " + i / 100000 + " (" + (cur - last) + " ms)"); last = cur; } } System.out.println("Done."); } }; thread.start(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }