问题
SWT is designed to support multiple Display
instances, each one with its own event loop. For what purpose this is useful or required? Isn't one Display
instance (e.g. Display.getDefault()
sufficient?
回答1:
The docs for the Display class says "Applications which are built with SWT will almost always require only a single display". The Display instance is closely tied to the UI thread, and has certain restrictions on it in order to allow the SWT event model to work on top of the native UI event model.
The only case is if you have multiple (native) UI threads, but I am not sure in which cases this is supported. According to this quote, multiple displays are not supported on GTK or on the Mac.
来源:https://stackoverflow.com/questions/4421075/swt-single-vs-multiple-displays