Create a Class diagram

Go to [Diagram] – [Class Diagram] to create a Class diagram.
A menu to create UML Class Diagram

section divider

Auto-create Class diagrams

You can automatically create Class diagrams of a package.

  1. If you have source code, import first to Astah.
    How to import Java source code
    Use Plug-ins to import source code (C++, C#, and Java)
  2. Right-click on a package in a tree view and select [Auto Create Class Diagram]
    Auto Create Class Diagram Menu
  3. Now you have three options.
    Auto Create Diagram Options

1. Simple

This creates a class diagram without Attributes and Operations inside the classes.
Auto Create Class Diagram in Simple Way

2. Detailed

This creates a class diagram with Attributes and Operations inside the classes.
Auto Create UML Class Diagram

3. Unpack Subpackages

This creates a class diagram with the whole models including models inside the sub-packages if the package you select has sub-packages.
Unpack SubPackages

section divider

Class

Creating a Class

You can find out 5 ways to create a Class in the Diagram Editor page.
UML Class


Template Class

You can create a Template Class by adding Template Parameters to a class. There are two ways to do so.
Template-class

  1. Select [Add Template Parameter] from Class’s Pop-up menu
    Adding a template class

  2. Define details at the bottom-left pane under [Template Class].
    Template-class-property
section divider

Attributes

You can create Attributes by clicking the orange diamond that appears when you have a mouse over a Class.
Attribute-diamond

Also, you can create another attribute by hitting the [Enter] key while an attribute is selected.
Creating Attributes

Since version 8.5, you can add Attributes by pasting a copied text.
Add Operation by text

Attribute Visibilities

There are several ways to show/hide attributes.
In order to change the visibility of attributes on a currently-opened diagram, open the [Initial Visibility] tab from the left-bottom pane in Astah and check the options you want in a diagram and click the [Apply to existing elements] button.
Initial Visibility in Class Diagram

section divider

Operations

You can create Attributes by clicking a green bar that appears when you have a mouse over a Class.
Green bar to add operations

Also, you can create another attribute by hitting [Enter] key while an attribute is selected.
Methods to Class

Moving Attributes/Operations

You can move around attributes/operations by dragging them to another class or within a class.
Moving attributes

Since version 8.5, you can add Operations by pasting a copied text.

Add Operation by text

section divider

Anonymous Bound Class

You can create an anonymous bound class by deleting the name of Bound Class.
Anonymous Bound Class

Anonymous Bound Classes can be specified to the following:

  • Attribute Type
  • Operation Return Value
  • Operation Parameter Type
  • The target of Association End A and Association End B
  • Base Class of Instance Specification in Class
  • Base Class of Object Node in Activity Diagram
  • Base Class of Lifeline in Sequence Diagram and Communication Diagram

Example of creating a Bound Class

  1. Create a abound class.
  2. Create a new class and add an attribute whose type is bound class to it.
    Bound Class

  3. When you add the class, you will be asked if you’d like to create a new class. Click [Yes].
    Box to ask a new class

  4. Click [Show Hidden Relationship] from its pop-up menu.
    Show hidden menu

  5. Then you will get the relationship of the anonymous bound class.
    Anonymous Bound Class

section divider

Nest a Class

You can have a class nested to a package by dragging it into a Package.
Nested Class

section divider

Association

You can create associations by choosing an association type from a small icon list that appears when you hover a mouse over a class, then directly click on the target class.
Create Associations via Draw Suggest
Please refer to “Drawing Lines” for more information.


Jump to Association Ends

You can jump to the Association ends from association line’s pop-up menu.

  1. Right-click on the Association and select [Move to related element].
  2. Select one that you want to jump to.
    Move to Related Element

Relocate Association name

As your diagram gets complex, association names could be left out and end up being far away from the association line.
In that case, you can bring the association name back to the center of the association line.
Right-click on an association line and click [Init Label Position].
Bring association name back