Creating Methods in StructureBuilder

Home Up Search Java 2 API C++ Resources

Methods of classes can be manipulated by working with in the Properties Dialog of the desired class.

  1. Double click  the desired  class in the class diagram to bring up its Properties Dialog.
  2. Click on the "Methods" tab.
  3. To add a new method click on "New" below the methods list.
    1. To create a constructor, select "constructor from the drop list.
    2. To create a regular method, select "user method" form the drop list.
      1. Replace the name of the methods with the desired name.
      2. Type in the return type or select it from the drop list.
  4. If the method has parameters, click the "Parameters" tab.
    1.  Select "New" from below the parameters list
    2.  Replace the name with the desired name.
    3. Type in the parameter type or select it from the drop list.
  5. Comment the method by selecting the "Comment" tab.
  6. Commenting the individual parameters does not always work properly.    To get around this, follow this procedure:
    1. Click on the "Comment" as if you were commenting the entire method.
    2. Click on the small yellow box at the upper left corner of the comments window.   This will bring up the annotations editor.
    3. The original method comments may be lost at this stage unfortunately.
    4. Click on the "Synchronize" button and the available parameters will appear.
    5. Fill out the text areas for the individual parameters' comments and the main method's comments in the annotation editor.
  7. To edit the body of the method, select a method and then click the "Body" button and an editor will appear with only the body of that method.    Click on "Signature" to return to viewing all the methods.
  8. Automatic code generation for the initialization of instance variables with a constructor is possible:
    1. Select the constructor
    2. Click on the "Body" button.
    3. While holding Ctrl key, select the variable that need to be initialized through the constructor.  
    4. SB will generate code to take those variables as inputs to the constructor and will write the code to set them.   Do not modify this code by hand.   To alter it, change the variables being initalized.
    5. Click the "Signature" button to return to viewing all the methods.
    6. To change the order in which the variables are called in the constructor input, change the order in which they appear in the class diagram by clicking the up and down arrows next to the Parameters tab.