IntelliJ IDEA 2023.3 Help

Creating Listeners

GUI Designer enables you to create listeners for components. The components that have listeners are marked with a special icon icon_listener.png that shows up when such component is selected. From the components in the Form Workspace and in the Components tree view, you can quickly navigate to the respective source code.

To create a listener

  1. Select component in the Form Workspace, or in the Components tree view.

  2. On the context menu, choose Create Listener, or press Ctrl+O.

  3. From the Create Listener pop-up menu, select the desired listener type.

  4. In the Select Method to Override dialog, select the desired method. Optionally, specify whether you want the JavaDoc comment for this method to be copied to the target file, and click OK. The stub method that overrides the specified method is added to the bound class.

  5. If you want to modify the body of the stub method, edit the Overridden Method Body file template:

    In the File Templates dialog, open the Code tab, and edit the template as required.

To navigate from a component to listener

  1. Select component in the Form Workspace, or in the Components tree view.

  2. From the context menu, select Go to Listener.

  3. In the Navigate to Listener pop-up menu, click the desired listener, or press Ctrl+Alt+B.

Last modified: 19 March 2024