WindowStateAdapter (@NotNull Window window) { for (ComponentListener listener : window.getComponentListeners()) { if (listener instanceof WindowStateAdapter) { return (WindowStateAdapter)listener; } } return new WindowStateAdapter(window); }