void (Graphics g, int p0, int p1, Shape bounds, JTextComponent c) { try { Rectangle target = c.getUI().getRootView(c).modelToView(p0, Position.Bias.Forward, p1, Position.Bias.Backward, bounds).getBounds(); Graphics2D g2d = (Graphics2D)g.create(); try { g2d.setStroke(STROKE); g2d.setColor(c.getSelectionColor()); g2d.drawRect(target.x, target.y, target.width - 1, target.height - 1); } finally { g2d.dispose(); } } catch (Exception e) { LOG.warn("Error painting link highlight", e); } }