How can I hide the opened list component by click anywhere ? Just like combobox

I’m still new at the JUCE and I’ve just started learning.
I wrote a custorm component that contain label, button, and a simple date selector like Windows system has.
I set the selector hidden when click the On/Off button or you have select a right date.But now I have a very terrible question.I cannot hide the selector when use mouse click other place which out of the selector’s bounds.You cannot sure where you have click, that’s maybe a label, button, listbox…everything is possible.
I cannot control global.

How can I do? How can I hide the opened date selector by click outside? Just like combobox, you click anywhere ,the drop-down list always close.

(The date-selector is created by extend “Component” .Just added in some button and label.)

By the way,it’s compile on windows perform.