Java Tutorial/SWT/SWT Thread

Материал из Java эксперт
Перейти к: навигация, поиск

17. SWT Time-Consuming Operation UI Pattern

SWT does not allow non-UI threads to access user interface components directly.



Thread operationThread = new Thread() {
        public void run() {
            // time-consuming operations
            display.asyncExec/syncExec(new Runnable() {
                public void run() {
                // UI Updating procedures go here ...
                }
            });
        }
    };
    operationThread.start();



Professional Java Interfaces with SWT/JFace by Jackwind Li Guojie John Wiley & Sons 2005