1
votes

how can I specify the box width of an UML class diagram. In the example I use classA and classB and want them to have the same box witdh (yellow) so that the width is independent of the method / attribute names.

Please find the UML code below and the attached screenshot with the current result (left) and the prefered result (right).

Thanks a lot for your support :)

@startuml testWidth
class classA {
{field}  - attributeA : int
{field}  - attributeB : int
{method} + methodA()
{method} + methodB()
{method} + veeeeeeery_looooong_named_method()
}
class classB {
{field}  - attributeC : int    
}
classA <|-- classB
@enduml

enter image description here

1

1 Answers

2
votes

There exists a skin parameters minClassWidth and SameClassWidth for plantuml. As far as I can tell is SameClassWidth the one you are looking for

@startuml
skinparam SameClassWidth true
class classA {
{field}  - attributeA : int
{field}  - attributeB : int
{method} + methodA()
{method} + methodB()
{method} + veeeeeeery_looooong_named_method()
}
class classB {
{field}  - attributeC : int    
}
classA <|-- classB
@enduml

See for the result: http://www.plantuml.com/plantuml/umla/ROvD2i8m48NtESLRAj8BY8kcFO8BboMQqGQJL9A98BLtjpKM5FiM8VD-u2iZgy39MH6lnjzKK0vxvQYsAiQ3qTo2Go9nccwyNubUYFvioEe1AA2OWpac9eajZEV5h9epHznsOxX1_idL-j-iViqxPOL7Oxj9_j9uvKWtkJEsXs_22lqYH9qXC6eUIEoUHV6PYPAyJiw-0000

You can get all the skin parameters by means of the command:

java -Djava.awt.headless=true -jar plantuml.jar -language