javawindowlistenerjide

Jide DockableFrame: how do use WindowListener for my docking frame?


I'm using the DockableFrame class (extends JComponent) from the Jide docking framework.

I want to add a listener to run some code when the docking frame is closed.

I tried to find information but every source I read tell me to use addWindowListener(), which I can't do because DockableFrame is not a JFrame and doesn't have the addWindowListener() method.

How can I add a listener that fires when the docking frame is closed?


Solution

  • Use addDockableFrameListener() with dockableFrameHidden() instead of addWindowListener():

    addDockableFrameListener(
        new DockableFrameAdapter() {
          @Override
          public void dockableFrameHidden(DockableFrameEvent dockableFrameEvent) {
            ...
          }
        });