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

Chapter 6. SWT Buttons > Responding to Button Clicks

6.2. Responding to Button Clicks

A button is useless unless you provide some mechanism that responds to the user having clicked the button. To do that, you must add a SelectionListener to the button and develop code in the widgetSelected( ) event to accomplish the desired task.

6.2.1. How do I do that?

To respond to the button being clicked by the user, you need to add a SelectionListener to the code shown in Example 6-1:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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