简体   繁体   English

UML序列图WindowListener

[英]UML Sequence Diagram WindowListener

I'm just starting to learn how to write Sequence Diagrams for Java programs at the moment. 我现在刚刚开始学习如何为Java程序编写序列图。

I have the task to write a Sequence Diagram for a given Java Class called KeyTest that extends the java.awt.Frame class. 我的任务是为给定名为KeyTest的Java类编写序列图,该序列图扩展了java.awt.Frame类。 In this diagram, a KeyListener and a WindowListener is added to the KeyTest class via this.addKeyListener(this) . 在此图中,通过this.addKeyListener(this)将KeyListener和WindowListener添加到KeyTest类。 How do I implement that and the KeyPressed, KeyTyped and KeyReleased Operations in the Sequence Diagram? 如何实现该功能以及序列图中的KeyPressed,KeyTyped和KeyReleased操作?

For some reason we have only been told how to add an ActionListener to a button, but not to the class itself. 出于某种原因,我们仅被告知如何向按钮添加ActionListener,而不向类本身添加。

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. KeyTest扩展了java.awt.Frame的事实进入了一个类图,并将以概括的形式显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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