Overriding Methods

When you want to override interface and superclass methods in a Java file, use the Override Methods tool to quickly select from all the available methods.

The Override Methods tool generates the selected methods with proper declarations. You override the methods with your own code in the Source Editor.

To generate code for overriding methods:

  1. Right-click your Java file's class node (class node explorer icon) in the Explorer window and choose Override Methods from the contextual menu.

    The Override Methods dialog box is displayed. The All Inherited Classes list contains all the superclasses that your class inherits from. This list also contains all interfaces that your class implements and their superclasses.

  2. Select one or more items from the All Inherited Classes list to display methods declared in those classes or interfaces.

    The Available Methods field lists all of the selected items' methods that can be overriden. The IDE filters out final, static, private, and package-private methods.

    Use the options to the right of the Available Methods list to fine-tune the methods displayed in the list:

  3. In the Available Methods list, select the methods you want to override. Click Add to add the selected methods to the bottom panel.
  4. If you want the methods that are generated in your class to contain calls to the superclass method, select the Generate Super Calls checkbox at the bottom of the Selected Methods list.
  5. The Selected Methods list contains all the methods you selected in Step 3. This list also contains all of the methods that were already redefined in your source code before you ran the Override Methods tool.
  6. When the Selected Methods list contains all the methods you want to override, click OK.

    Methods that you added to the Selected Methods list are created in your class's source file with proper declarations and empty bodies or superclass calls.

See also
Synchronizing Source Code
Using the Import Management Tool

Legal Notices