UML Modeling on NetBeans, Part IV: Generate a diagram from existing code
Java, NetBeans, Programming February 17th, 2007Now I will show about how to generate a diagram from an existing code. It also can be called reverse engineering method. This example I will generate a class diagram from my existing source codes.
- Create a new Project. File -> New Project
On left side, Category, select UML.
On right side, Projects, select Reverse Engineer a Java Project. Then click Next. - Project Name, type ‘UMLDemo’ or any name you want.
On the middle, you’ll see Java Project, select the project that contain existing source code that you want to create a diagram. Then move down a bit, ensure the check box has been checked on the folder that contain the source code.
In this example, I select Dicomu project and check only src folder which contain my source code. - When the project has created, try expand Model -> your source project name on the Projects window. You’ll see the files from your source project has been created here as in the figure below.
- Select the file names that you want to create a diagram by highlight them (hold shift + select first and last file). I select almost all files from my source project except TestDicom.
- Then right click on the highlight files, select Create Diagram From Selected Elements…
- In Diagram type, select Class Diagram and Name as DicomuClassDiagram.
The namespace leave it as the same. Click Finish. - The class diagram will be generated as the figure below. Notice that the relation also been created from the source code automatically. For how to export a diagram to image can be found at the bottom in Part II.



That’s all. Complete all 4 parts. I think these series of tutorial can help you understanding and using UML Modeling on NetBeans better.
Related post
- 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 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...
- 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:








July 26th, 2007 at 10:49 am
this is great…..
can u send me the tutorial(uml modeling)?pls
July 29th, 2007 at 11:17 pm
You can save the tutorial from your browser by yourself for reading when off-line. For example; Internet Explorer, click File -> Save As.. –> select type as Web archive, single file.
March 19th, 2009 at 12:04 pm
Best response out of all!!
May 5th, 2009 at 8:35 pm
linglom,
Thank you so much!
You’re the greatest.
March 18th, 2011 at 4:32 pm
instead of reverse engineer a netbeans project can you reverse engineer one single java class?
May 2nd, 2011 at 10:42 pm
your tutorial real help me…
thanks ….
May 6th, 2011 at 7:28 am
Hi,
followed the steps above but the UML didn’t populate with source from my project.using NB6.8
Any ideas