This tutorial refers to Netbeans IDE 5.5.

Getting Started with Netbeans UML modelling Tools

Call it Reverse Engineering. Netbeans 5.5 Unified Modelling Language (UML) tools enables you to generate UML Diagrams - class diagrams, sequence diagrams, activity diagrams et. al automatically from your source code. Yes,you heard it right! There is no need to manually draw the UML diagrams any more for your Java source code.
If you are wondering why should we use UML, check out The Importance of Using the Unified Modelling Language.
It is always a good practice to first get a feel of what we are trying to accomplish in this tutorial. As a primary goal, I shall give you a hands-on approach to create UML class diagrams for your project. We shall not bother ourselves with other UML diagrams - sequence diagrams, activity diagrams, etc. For the purpose of this tutorial the java project that I am going to use is NOT a dummy project, it is the ODF Toolkit for Java project and I am a mentee in that project. So the class diagrams that is shown here are highly detailed and contain many classes, packages. My suggestion is that before getting started with this document, create a simple "Hello World" java project for yourself to test the steps given here.

Netbeans UML modelling tools

Before you can start using the UML modelling tools, you will have to install them using the Netbeans update center. Go to Tools -> Update Center. After all the module lists have been retrieved select the UML Modelling Pack. File:uml-nb_NetbeansUML.PNG

For more detailed instructions on installation you may refer this page

Generating UML Class Diagrams

  • Open the project for which you want to genearate the class diagram
  • On the package view on the left hand side in Netbeans, Right-click on the project Name. On the menu that appears, select Reverse Engineer. You will get the following dialog box

File:Screenshot-3_NetbeansUML.png Select a project name and location

  • The project window should now look like this:


  • Now click on the UML project you just created and hence click on Model. This gives a view of all the packages in your project.


  • Now, Right-click on the package for which you want to generate the class diagram and from the menu, select Diagram. This brings you to the following screen:

File:Screenshot-6_NetbeansUML.png Select Class Diagram and click Finish

  • The class diagram is generated and reproduced below:


  • You can now export and save the class diagram as a PNG, JPEG image


Future To Do's

  • Explore Sequence diagrsms, activity diagrams
  • Generate Code from UML diagrams

..Add more

Comments / Suggestions awaited! Amit Kumar Saha

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo