// don't paint over the selection background
Area selection = getTextPaneSkin().getSelection();
if (selection != null) {
Area fillArea = new Area(new Rectangle(nodeViewBounds.x, nodeViewBounds.y, nodeViewBounds.width, nodeViewBounds.height));
selection = selection.createTransformedArea(AffineTransform.getTranslateInstance(-skinX, -skinY));
fillArea.subtract(selection);
nodeViewGraphics.setColor(styledBackgroundColor);
nodeViewGraphics.fill(fillArea);
} else {
nodeViewGraphics.setColor(styledBackgroundColor);
nodeViewGraphics.fillRect(nodeViewBounds.x, nodeViewBounds.y, nodeViewBounds.width, nodeViewBounds.height);