<<Previous Next>>
Explain how SWT’s event
handling is different from that of Swing. Describe how Display class
plays the most important role in SWT event handling.
SWT Event handling - Jan 19,
2009 at 15:00 PM by Vidya Sagar
Explain how SWT’s event handling is different from that of
Swing.
Swing: GUI tool kit for
JSE. SWT: Developed by IBM for Eclipse
platform
Swing event handling: Swing’s
events are thread based. An event dispatch thread is responsible for
handling events. The container had to check the actual source for
each event before processing. An event may be handled by one or more
containers and may cause complexity while handling the
situation.
SWT event handling: The SWT components or
their events are not thread safe. The SWT events are based on
the native application which increases performance. The SWT event
handling loop reads and dispatches the concerned GUI events. In
SWT the UI-thread (ex. Display instance) handles the events from the
operating system event queue by invoking the appropriate events.
Describe how Display class plays the most important
role in SWT event handling. The Display class instances
are responsible for the complete management of connections between
SWT and the underlying operating system. The implementation of the
SWT event looping is the most important function of the Display
class. The Display class has various methods to obtain information
about the underlying operating system. This class controls the OS
resources which were allocated by the SWT completely.
|