Panel with CloseButton and Listener

Hello,

I would like to build an extendedPanel with some functions like footer and a header with closeButton (like the one in every window). I’ve got already a panel with the a selfmade header with this closebutton and my preferred footer. But I have no idea how I can handle, that the panel can remove itself from the site. I don’t want to write an external function in our controller.
Do you guys have any ideas how I can archiv something like that?

Best regards,
Christian

You can try this:

((ComponentContainer)yourPanel.getParent()).removeComponent(yourPanel);

If you don’t want to use casting, you can pass the parent ComponentContainer to your panel constructor, so it knows its parent. Or you can check if getParent() is instance of ComponentContainer.

Thanks you. It works as expected!