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

Chapter 14. Dialogs > Opening a Dialog

14.2. Opening a Dialog

By convention, all dialogs implement the open() method. This method creates a shell and some controls, makes the shell visible, runs an event loop, and waits for the user to close the shell before proceeding. When the dialog is native, these operations are performed by the operating system. Custom dialogs implement this behavior using SWT API. The important factor that is common to both is that the open() method does not return until the dialog closes.

The type of result returned by the open() method depends on the particular dialog. For example, open() for ColorDialog returns an instance of class RGB, whereas open() for DirectoryDialog returns a directory path. Because the return value of this method is different between dialogs, open() cannot be implemented in Dialog.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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