JLabel (@Nullable @Nls String text, @Nullable Icon icon, int alignment) { JLabel label = new JLabel(text, icon, alignment) { @Override protected void paintComponent(@NotNull Graphics graphics) { Graphics2D g2 = (Graphics2D)graphics.create(); try { float alpha = translucent ? 0.5f : 1.0f; g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); super.paintComponent(g2); } finally { g2.dispose(); } } @Override public void setUI(LabelUI ui) { super.setUI(ui); if (!SystemInfo.isWindows) { Font font = getFont(); font = new FontUIResource(font.deriveFont(font.getStyle(), font.getSize() - JBUIScale.scale(2))); // Allow resetting the font by UI setFont(font); } } }; label.setForeground(JBColor.lazy(() -> ObjectUtils.notNull(colorsScheme.getColor(ICON_TEXT_COLOR), ICON_TEXT_COLOR.getDefaultColor()))); label.setIconTextGap(JBUIScale.scale(1)); return label; }