int (Icon icon) { int centerRelative = (myEditor.getLineHeight() - icon.getIconHeight()) / 2; int baselineRelative = myEditor.getAscent() - icon.getIconHeight(); return Math.max(centerRelative, baselineRelative); }