private static TextAttributes mergeAttributes(TextAttributes primary, TextAttributes secondary) { if (primary == null) return secondary; if (secondary == null) return primary; return new TextAttributes( primary.getForegroundColor() == null ? secondary.getForegroundColor() : primary.getForegroundColor(), primary.getBackgroundColor() == null ? secondary.getBackgroundColor() : primary.getBackgroundColor(), primary.getEffectColor() == null ? secondary.getEffectColor() : primary.getEffectColor(), primary.getEffectType() == null ? secondary.getEffectType() : primary.getEffectType(), primary.getFontType() == Font.PLAIN ? secondary.getFontType() : primary.getFontType()); }
private void paintBackground( Graphics2D g, TextAttributes attributes, float x, int y, float width) { if (attributes == null) return; paintBackground(g, attributes.getBackgroundColor(), x, y, width); }