How to make the message to be closed when understood ?


I need your help or some pointers

In my web application, I am displaying a warning message and a dashboard to the user.

The message is a label that tells some information about the dashboard. I am playing the dashboard in browser frame.

Please refer to the code below,

Label warningMessage = new Label("Warning : Dashboard is only accessible under local network/VPN.");
BrowserFrame boxInfo = new BrowserFrame(null, new ExternalResource(address));
VerticalLayout layout = new VerticalLayout();
layout.setExpandRatio(warningMessage, 0);
layout.setExpandRatio(boxInfo, 1);

My requirement as follows,

The label or any other component that display the message, should have a privilege to be closed as soon as the user clicks “X” button on the label.

It should be like

Warning : Dashboard is only accessible under local network/VPN. X

When the user reads the message and clicks on the “X” button/whatever it is. The message should disappear and browser frame needs to be re-sized to occupy the space of the label/component.

Please advice how to do this.