You can use Class Outline to add a method or member variable to a class, or to add a new class to your .java file.
To add a new declaration
Right-click the name of a class in Class Outline to add a method or member variable.
-or-
Right-click the Class Outline window to add another class to the file.
On the shortcut menu, click Add Class, Add Member Variable, or Add Method.
If you are adding a class, enter the class information in the Add Class dialog box:
Enter the name of the class in the Class Name box.
To make this class a nested (or inner) class of the class that is currently selected in Class Outline, select the Create a Nested Class option. For information about nested classes, see Inner Classes in the Java Language Specification.
Select an access modifier from the Access drop-down list. Nested classes can be declared as public, protected, private, or default (package). Non-nested classes can be declared as public or default.
Select additional modifiers, such as abstract, final, or static. (Only nested classes can be declared as static.)
To insert Javadoc comments for the class, enter the comment text in the Javadoc Comment box.
To display this class as the selected class in Class Builder, click Display new class in Class Builder. (Class Builder is automatically opened if it is not currently open.)
Click Add.
If you are adding a member variable, enter the member variable information in the Add Member Variable dialog box:
Enter the name of the member variable in the Member Variable Name box.
Select a data type from the Data Type drop-down list or enter your own data type.
Select an access modifier from the Access drop-down list. Member variables can be declared as public, protected, private, or default (package).
To initialize the member variable, enter a value in the Initial Value box.
To insert Javadoc comments for the member variable, enter the comment text in the Javadoc Comment box.
Click Add.
If you are adding a method, enter the method information in the Add Method dialog box:
Enter the name of the method in the Method Name box.
Select a return type from the Return Type drop-down list or enter your own return type.
In the Parameters grid, specify the method parameters. In the left column of the grid, select a parameter type from the drop-down list or enter your own type. In the right column, enter the name of the parameter.
Select an access modifier from the Access drop-down list. Methods can be declared as public, protected, private, or default (package).
To insert Javadoc comments for the method, enter the comment text in the Javadoc Comment box.
Click Add.
The new declaration is inserted into the .java file, where you can add your implementation. Class Outline is automatically updated to display the new item.
Note If you use the Text editor to add a declaration, the item is automatically added to Class Outline.