void (boolean clean) { if (myCurrent != null) { Graphics graphics = myCurrent.getGraphics(); Graphics2D currentFocusGraphics = (Graphics2D)(graphics != null ? graphics.create() : null); try { if (currentFocusGraphics != null) { if (clean) { if (myCurrent.isDisplayable()) { myCurrent.repaint(); } } else { currentFocusGraphics.setStroke(new BasicStroke(JBUIScale.scale(1))); currentFocusGraphics.setColor(myTemporary ? JBColor.ORANGE : JBColor.GREEN); UIUtil.drawDottedRectangle(currentFocusGraphics, 1, 1, myCurrent.getSize().width - 2, myCurrent.getSize().height - 2); } } } finally { if (currentFocusGraphics != null) currentFocusGraphics.dispose(); } if (myPrevious != null) { Graphics2D previousFocusGraphics = (Graphics2D)(myPrevious.getGraphics() != null ? myPrevious.getGraphics().create() : null); try { if (previousFocusGraphics != null) { if (clean) { if (myPrevious.isDisplayable()) { myPrevious.repaint(); } } else { previousFocusGraphics.setStroke(new BasicStroke(JBUIScale.scale(1))); previousFocusGraphics.setColor(JBColor.RED); UIUtil.drawDottedRectangle(previousFocusGraphics, 1, 1, myPrevious.getSize().width - 2, myPrevious.getSize().height - 2); } } } finally { if (previousFocusGraphics != null) previousFocusGraphics.dispose(); } } Util.drawOnActiveFrameGraphics(g -> { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(myApplicationState.getColor()); g.fillOval(5,5, 10, 10); g.setColor(JBColor.black); g.setStroke(new BasicStroke(2)); g.drawOval(5,5, 10, 10); }); } }