UML Modeling on NetBeans, Part 2: Create a Use Case Diagram

This entry is part 2 of 4 in the series UML Modeling on NetBeans 5.5

UML Modeling on NetBeans, Part 2: Create a Use Case Diagram

A Use Case diagram is useful when you are describing requirements for a system in the analysis, design, implementation and documentation stages.

This part will show you how to create a Use Case Diagram on NetBeans.

  1. Create New Project, File -> New Project…
  2. In Categories, select UML -> Java-Platform Model. Click Next.
    If you can’t see UML, try go back to Part I: Installation
    UML Category
  3. Type ‘UMLDemo’ in project name or any name you want. Click Finish.
    Create new project
  4. New window appear, for Diagram type, select Use Case Diagram and named as UseCaseDiagram or any name. Click Finish.
    Create Use Case Diagram
  5. Now the project has been created and you’ll see Palette window that contain tools for create Use Case Diagram. If you can’t see Palette window, try select tool on menu and choose Palette or press Ctrl + Shift + 8.
    Use Case Project windowUse Case's Palette window

Create a Use Case elements

  1. To create a Use Case element, click on Use Case icon in Palette window and click on the empty space of diagram.
    Then type ‘Rent items’ and press Enter.
    To change text on a Use Case, right click on the empty space to de-select a Use Case tool in Palette and click on the Use Case Diagram and type some text.
  2. To create an Actor is the same as previous step. Create an actor named ‘Customer’ and ‘Staff’. The diagram will look similar below.
    Create elements

Create a link between elements

  1. Next, I’m going to create a link between two Actors. First, select Generalization icon in Palette window. Then click on the ‘Customer’ actor, the arrow appears. Then, click on ‘Staff’ actor.
    Create link between actors
  2. To create a stereotype, simply click on the generalization link -> properties -> stereotype -> add -> type ‘implementation’ or stereotype name that you want. Click OK and Close.
    Create stereotype on the link
  3. Next, I’m going to link between an Actor and a Use Case. Select Association icon in Palette window. Then, click on an Actor ‘Staff’ and a Use Case ‘Rent items’.
    Create link between a Use Case element and an Actor
  4. Right-click anywhere in the empty space to de-select the Association link. You’ll see the link color become black.
  5. Point the cursor to the center of the line representing the link and right-click the Association link. Notice when select the link, color will become blue.
    Highlight association link
  6. Select Labels > Link Name from the pop-up menu. Type ‘uses’ and press Enter. The link will show as below.
    Set label on link

Create a link between Use Case elements

  1. Crate a new Use Case element name ‘Maintain customers’.
  2. Now, I’m going to create include link. Select Include icon in Palette window.
  3. Click once in the Rent items element, and click again in the Maintain customers element. The link appears as below.
    Create an include link
  4. For extend link, use similar way. Try to create extend link as the figure below.
    Create an extend link
  5. To rearrange the diagram, click the Orthogonal Layout button Orthogonal Layout icon on the Diagram toolbar.
    The Orthogonal Layout button on toolbar
  6. Click Yes in the Layout warning dialog box. The diagram will be rearranged as below. You can try other arrangements that will suit you.
    Rearranged result
  7. Click Save to finish.

Export an diagram to image

  1. Now you have created a diagram, what if you want to save it to a general image file format? Currently, it can export in .jpg, .png, .svg formats.
    First, select Export as image icon on the Diagram toolbar.
    Export as image on toolbar
  2. Then, select Type of image and destination of file that you want. Click OK and you’re done!.
    Export as Image window

Now you have a basic to create a Use Case diagram so you can apply these to create other diagram.
Pretty easy, isn’t it?. In coming soon part, I will show how to generate code from the diagram.

Series Navigation<< UML Modeling on NetBeans, Part 1: InstallationUML Modeling on NetBeans, Part 3: Generate code from UML Diagram >>

18 Comments

  1. Ralph February 11, 2007
  2. linglom February 11, 2007
  3. Ivan Fonseca February 13, 2007
  4. linglom February 13, 2007
  5. Daniel Tebar February 13, 2007
  6. Daniel Tebar February 13, 2007
  7. Antonio March 1, 2007
  8. Craig Conover August 15, 2007
  9. Lenka February 4, 2008
  10. linglom February 5, 2008
  11. Lenka February 27, 2008
  12. David Chow June 1, 2008
  13. linglom June 2, 2008
  14. Mirek August 30, 2008
  15. linglom September 1, 2008
  16. Jerry September 12, 2008
  17. BADBOY March 2, 2011
  18. Achala August 10, 2011

Leave a Reply