简体   繁体   中英

UML Sequence Diagram WindowListener

I'm just starting to learn how to write Sequence Diagrams for Java programs at the moment.

I have the task to write a Sequence Diagram for a given Java Class called KeyTest that extends the java.awt.Frame class. In this diagram, a KeyListener and a WindowListener is added to the KeyTest class via this.addKeyListener(this) . How do I implement that and the KeyPressed, KeyTyped and KeyReleased Operations in the Sequence Diagram?

For some reason we have only been told how to add an ActionListener to a button, but not to the class itself.

All those are operations of a class. And these correspond to messages sent from somewhere to this class, triggering the execution of the operation. Just like so:

在此处输入图片说明

The fact that KeyTest extends java.awt.Frame goes to a class diagram and will be shown with a generalization.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM