Create Method
The Add Method SmartGuide lets you create a new method, constructor, or main() method,
or add an existing method from the repository. The method is added to the class that
was selected when you started the SmartGuide.
To create a new method, constructor, or main():
- Select the appropriate radio button for the type of method you want to create.
- Input the method's signature, specifically the return type, the method name, and the
list of parameters. To select a type, rather than keying it in:
- Place the cursor where you need the type name (in the return type location or in the
list of parameters).
- Click the Types button.
- In the Types dialog box, enter a search Pattern based on the
unqualified type name. For example, if you want the type sun.awt.image.Image,
type "Im".
- Select the desired Type Name.
- Select the desired Package Name. For example, if you selected the
type name, Image, there may be two packages that have a type called Image, java.awt
and sun.awt.image.
- Click Insert. The type is inserted into the method signature at
the cursor. If the type requires package qualification, based on the class' import
statement, it is provided.
- Click Next to specify additional options, including modifiers and
exceptions.
To add a method from the repository:
- Select the Add methods from the repository radio button.
- The Available names list shows all the methods that can be added to the
current class. Only methods that were created for the current class can be added
back. Select the method by enabling its check box.
- The Available editions list shows all the editions of the selected
method that can be added. Select one by enabling its checkbox.
- Click Finish.
