Representation of rotation components in UML class diagrams

I have some questions regarding the representation of gui objects in uml class diagrams.

For example, if a has a class that extends JFrame, then I will create a UML class diagram with an inheritance symbol, but in JFrame I do not need to write all its class variables and methods, but only those whose class will use correctly?

Secondly, how can I imagine that my class will use a specific layout manager? With a symbol of association, I want, but I'm not sure.


Say, for example, I have a package called gr.mydomain.exampleproject , and I have a class extending JFrame.

Is the following approach correct or do I need to put the JFrame in a separate package ( javax.swing )?

enter image description here

+4
source share
1 answer

Yes, you should draw an inheritance character to the JFrame class, but leave the JFrame class empty, do not put any fields or methods into it. Everyone knows or can look at the API to find out what the JFrame contains. In addition, you fill the space with the multitude of methods presented in the JFrame .

Do it like this:

UML screenshot

Regarding layout managers: I believe the dependency relationship is the right one in this situation. An association relationship would be correct if you called methods in the layout manager class. But you are probably just doing something like frame.setLayout (new LayoutManagerClass ()); (aka just create an object). In this case, it is a dependency.

+5
source

Source: https://habr.com/ru/post/1411114/


All Articles