sclass ScreenOverlay is AutoCloseable { JWindow window; settable Color bgColor = colorWithAlpha(Color.blue, 0 /*.5*/); //= new Color(0, 255, 0, 128); settable Rect bounds; settable bool hideOnMouseOver; settable Component component; void show() swing { if (window == null) { if (usingJTattoo()) warn("Screen overlays don't really work with JTattoo"); assertNotNull(+bounds); window = new JWindow; window.setBackground(bgColor); main setBounds(window, bounds); window.setAlwaysOnTop(true); if (component != null) window.add(component); disposeWindowOnClick(window); if (hideOnMouseOver) addMouseListener(getContentPane(window), new MouseAdapter { @Override public void mouseEntered(MouseEvent e) { hide(); } }); } window.setVisible(true); } public void hide aka close() swing { if (window == null) ret; window.setVisible(false); } void daThing { component(new JPanel { protected void paintComponent(Graphics g) { g.setColor(Color.RED); g.drawRect(0, 0, 511, 511); } }); } }