I have created a program in which a **TabPane** contains multiple **Tabs**.
When someone tries to close any Tab, I want to execute my own code: when a user clicks on the default close button for any Tab, it will ask for confirmation. 
If the user says "Yes" then the tab will be closed, otherwise it will remain open.

How can I do this?

I am doing something like below. but the Tab is still getting closed. How would I consume that Tab?

```
Tab tab = new Tab();
TabPane tabPane=new TabPane();
tabPane.getTabs().add(tab);

tab.setOnClosed(new EventHandler<Event>() {
            @Override
            public void handle(Event t) {
                 t.consume();
            }
        });

```