UML Modeling on NetBeans, Part II: Create a Use Case Diagram
Java, NetBeans, Programming February 10th, 2007A 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.
- Create New Project, File -> New Project…
- In Categories, select UML -> Java-Platform Model. Click Next.
If you can’t see UML, try go back to Part I: Installation
- Type ‘UMLDemo’ in project name or any name you want. Click Finish.
- New window appear, for Diagram type, select Use Case Diagram and named as UseCaseDiagram or any name. Click Finish.
- 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.

Create a Use Case elements
- To create a Use Case element, click on
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. - To create an Actor is the same as previous step. Create an actor named ‘Customer’ and ‘Staff’. The diagram will look similar below.
Create a link between elements
- Next, I’m going to create a link between two Actors. First, select
in Palette window. Then click on the ‘Customer’ actor, the arrow appears. Then, click on ‘Staff’ actor.
- 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.
- Next, I’m going to link between an Actor and a Use Case. Select
in Palette window. Then, click on an Actor ‘Staff’ and a Use Case ‘Rent items’.
- Right-click anywhere in the empty space to de-select the Association link. You’ll see the link color become black.
- 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.
- Select Labels > Link Name from the pop-up menu. Type ‘uses’ and press Enter. The link will show as below.
Create a link between Use Case elements
- Crate a new Use Case element name ‘Maintain customers’.
- Now, I’m going to create include link. Select
in Palette window.
- Click once in the Rent items element, and click again in the Maintain customers element. The link appears as below.
- For extend link, use similar way. Try to create extend link as the figure below.
- To rearrange the diagram, click the Orthogonal Layout button
on the Diagram toolbar.
- Click Yes in the Layout warning dialog box. The diagram will be rearranged as below. You can try other arrangements that will suit you.
- Click Save to finish.
Export an diagram to image
- 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
on the Diagram toolbar.
- Then, select Type of image and destination of file that you want. Click OK and you’re done!.
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.
Related post
- UML Modeling on NetBeans, Part IV: Generate a diagram from existing code Now I will show about how to generate a diagram from an existing code. It also can be called reverse...
- UML Modeling on NetBeans, Part III: Generate code from a diagram In this part, I am going to show how to generate code from existing diagram so that it can reduce...
- UML Modeling on NetBeans, Part I: Installation Introduction This article show how to create UML Model on NetBeans and infers that you have already install NetBeans 5.5...
Related posts:




February 10th, 2007 at 9:56 am
[...] Part II: Create a Use Case diagram [...]
February 11th, 2007 at 10:03 pm
The images for 2., 3. and 5. are not being displayed and my broswer doesn’t seem to be blocking them.
February 11th, 2007 at 10:48 pm
I haven’t even noticed that before!. I tested only on Firefox browser and it doesn’t show any error message.
But I’ve already fixed them.
Thanks for telling the broken links.
February 13th, 2007 at 2:47 am
Great tutorial. I´d like to translate it to portuguese and give you credits. May I have your permition for do that?
February 13th, 2007 at 6:29 am
[...] Linglom’s Blog » Blog Archive » UML Modeling on NetBeans, Part II: 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. (tags: tutorial netbeans uml) [...]
February 13th, 2007 at 1:00 pm
To Ivan Fonseca,
Yes, you can as long as you conform with the license.
I’ve just put Creative Commons License (see bottom).
Feel free to ask if you have some problems.
February 13th, 2007 at 4:06 pm
Its getting there… I wish it had ‘align’ features, and that the arows behaved like ‘Enterprise Architect, from Sparx’….
February 13th, 2007 at 4:07 pm
–arrows….
March 1st, 2007 at 4:10 pm
Very nice site! Good work.
August 15th, 2007 at 12:42 am
Alignment tools are now available in NB 6 version of UML. See http://blogs.sun.com/conover/ for summary.
February 4th, 2008 at 4:44 pm
Hello, please help me.
I don’t understand what I am doing wrong. I have installed UML modul, I could open new UML project, create UserCaseDiagram, but I can not see the Palette window. I tried everything, CTR+SHIFT+8, or through menu, Window-Palette but nothing still I can not see
Thank you in advance for any other idea.
February 5th, 2008 at 11:12 am
Hi, Lenka
Have you try NetBeans IDE 6.0? It has integrated UML module in this version. May be it can solve your problem.
February 27th, 2008 at 8:27 pm
Hi linglom,
I have tried
and it helped. thank you.
June 1st, 2008 at 11:17 pm
Then how to generate the code from Use Case at Netbeans.
June 2nd, 2008 at 1:08 pm
You can generate code from a diagram by right click on the UML project in NetBeans and select Generate Code. Then, Generate Code window appears, you have to choose which target project to place the code. Click OK and you’re done.
August 30th, 2008 at 5:47 pm
Hi Linglom,
I might be wrong, but it seems to me that you used <> dependency instead of generalization. At least in UML 1.5, the extend dependency is described as “one use case can use the functionality of another use case”. I guess you mixed up with usage of ‘extend’ word in java – in UML it is represented by generalisation relationship, not by <> dependency. Rent CD is a special case of Rent Item, therefore you should use generalization.
September 1st, 2008 at 4:45 pm
Hi Mirek,
I’m not sure about UML concept now. But I’ve found this link which states that “The extends arrow (or extends edge) is drawn from a use case X to a use case Y to indicate that the process X is a special case behavior of the same type as the more general process Y.”
Reference: UML Use Case Diagrams: Tips
September 12th, 2008 at 2:16 pm
Can I use it to draw system boundary? I guess not. However, it’s the basic thing in use case diagram.