sclass DesktopPaneWithSkyPicture_autoUnload extends JDesktopPane { S imageID; BufferedImage image; new RestartableCountdown countdown; double autoUnloadAfter = 60.0; *(S *imageID) {} protected void paintComponent(Graphics g) { paintSkyBackground(this, g, _getImage()); } BufferedImage _getImage() { ret swing(func -> BufferedImage { if (image == null) image = loadImage2(imageID); countdown.start(autoUnloadAfter, r-awt { image = null; }); ret image; } } } static JDesktopPane jDesktopPaneWithSkyPicture_autoUnload(fS imageID, Color background) { ret setBackground(background, swingNu(DesktopPaneWithSkyPicture, loadImage2(imageID))); }