• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Display > Display Life Cycle

5.2. Display Life Cycle

Displays 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]

[2] Strictly speaking, this is not necessary if your program exits. In this case, all memory, including window system resources, is released back to the operating system. You should call the dispose method anyway because it will allow third-party operating system leak detection tools to distinguish between leaks and resources that were automatically released on shutdown.

5.2.1. Creation

Normally, 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.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint