You can define event handlers using a component's property sheet or contextual menu. You can also define an event handler using the Connection wizard.
To define an event handler using the property sheet:
After you press Enter, the code for the listener and the empty body of the handler method is generated. If you do not press Enter, no code is generated.
To define an event handler using the contextual menu:
If multiple events are of the same type (for example, focusGained and focusLost are both of the type java.awt.event.FocusEvent), you can use the same handler for all of them. For example, you could set both focusGained and focusLost to use the button1FocusChange handler. You can also use the same handler for the same event on multiple components.
![]() |
You can set the style of how the code for component
events and their handlers is generated. Choose Tools ![]() |
See Also | |
---|---|
Managing Component Events
Removing an Event Handler Renaming an Event Handler Adding Multiple Handlers for One Event Setting Events With the Connection Wizard |