|
|
< Day Day Up > |
|
5.2 Display Life CycleDisplays follow the same life cycle as widgets. They are explicitly created and disposed of by the programmer. Before you can do anything useful with SWT, you must create a display. When you are completely finished with the user interface for your application, call the dispose() method of Display.[2]
5.2.1 CreationNormally, displays are singletons. On some platforms, it is possible to have multiple displays active at the same time but this generally is not a useful programming metaphor. Instances of class Display are constructed using a simple no-parameter constructor.
5.2.2 DestructionDisplays are disposed of in the same manner as widgets, by calling their dispose() method.
Calling the dispose() method causes all widgets that were created on the display to also be disposed of. Accessing a display after the dispose method has been called causes an SWTException ("Device is disposed"). Displays support the method isDisposed() that returns true when the display has been disposed of and false otherwise. |
|
|
< Day Day Up > |
|