boolean (@NotNull Graphics g, @NotNull Rectangle clip) { CharSequence hintText = myPlaceholderText; if (myDocument.getTextLength() > 0 || hintText == null || hintText.length() == 0) { return false; } if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == myEditorComponent && !myShowPlaceholderWhenFocused) { // There is a possible case that placeholder text was painted and the editor gets focus now. We want to over-paint previously // used placeholder text then. myLastBackgroundColor = getBackgroundColor(); myLastBackgroundPosition = new Point(0, 0); myLastBackgroundWidth = myLastPaintedPlaceholderWidth; flushBackground(g, clip); return false; } else { hintText = SwingUtilities.layoutCompoundLabel(g.getFontMetrics(), hintText.toString(), null, 0, 0, 0, 0, myEditorComponent.getBounds(), new Rectangle(), new Rectangle(), 0); myLastPaintedPlaceholderWidth = drawString( g, hintText, 0, hintText.length(), new Point(0, 0), clip, null, null, myPlaceholderAttributes == null ? Font.PLAIN : myPlaceholderAttributes.getFontType(), myPlaceholderAttributes == null ? myFoldingModel.getPlaceholderAttributes().getForegroundColor() : myPlaceholderAttributes.getForegroundColor(), PAINT_NO_WHITESPACE ); flushCachedChars(g); return true; } }