void () { final Window window = SwingUtilities.windowForComponent(getContentPane()); window.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { final Dimension size = dimensionService.getSize(getPrivateDimensionKey()); if (size != null) { setSize(size.width, size.height); validate(); } } }); super.show(); dimensionService.setSize(getPrivateDimensionKey(), getSize()); dimensionService.setLocation(getPrivateDimensionKey(), getLocation()); PropertiesComponent.getInstance().setValue(getPrivateDimensionServiceKey() + ".MODE", myMode.ordinal(), 0); }