What is the common way to program action listeners?

前端 未结 6 1716
走了就别回头了
走了就别回头了 2021-01-06 01:10

I just started to learn how to use action listeners. To my understanding it works in the following way:

  1. There are some classes which contains \"addActionLis

6条回答
  •  迷失自我
    2021-01-06 01:27

    Beware that methods removeActionListener exists for a reason. You can skip listeners clean up if objects you listen to will die with object that handles events. But if your component listens the model supplied from external source, you should add your listeners in addNotify and remove them in removeNotify methods. Otherwise you may have a memore leak.

提交回复
热议问题