void (@Nullable JFrame frame, String text) { EDT.assertIsEdt(); if (!isValid(frame)) { return; } WinDef.HICON icon = null; if (text != null) { try { int size = 16; BufferedImage image = UIUtil.createImage(frame.getRootPane(), size, size, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); int shadowRadius = 16; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setPaint(errorBadgeShadowColor); g.fillRoundRect(0, 0, shadowRadius, shadowRadius, size, size); int mainRadius = 14; g.setPaint(errorBadgeMainColor); g.fillRoundRect(size / 2 - mainRadius / 2, size / 2 - mainRadius / 2, mainRadius, mainRadius, size, size); Font font = g.getFont(); g.setFont(new Font(font.getName(), Font.BOLD, 9)); FontMetrics fontMetrics = g.getFontMetrics(); int textWidth = fontMetrics.stringWidth(text); int textHeight = UIUtil.getHighestGlyphHeight(text, font, g); g.setPaint(errorBadgeTextBackgroundColor); g.fillOval(size / 2 - textWidth / 2, size / 2 - textHeight / 2, textWidth, textHeight); g.setColor(Color.white); g.drawString(text, size / 2 - textWidth / 2, size / 2 - fontMetrics.getHeight() / 2 + fontMetrics.getAscent()); byte[] bytes = writeTransparentIco(image); icon = Win7TaskBar.createIcon(bytes); } catch (Throwable e) { LOG.error(e); } } try { Win7TaskBar.setOverlayIcon(frame, icon, icon != null); } catch (Throwable e) { LOG.error(e); } }