Using MouseListener on Text Label

Hi, for my program I wanted to make it so that when you double click on a TextLabel component the text on it disappears. I know that there’s mouseListener method for that - mouseDoubleClick(). However, I don’t how to use it on my wanted component. Should I create a MouseListener() object and then override the mouseDoubleClick() method for it or what? I tried searching the docs for an answer, but they’re not really telling me much.

Thanks in advance

You’d derive your own Label class and override the methods like mouseDoubleClick()