g2.drawLine(-2, 0, -2, height);
g2.drawLine(width, 0, width, height);
g2.drawLine(width + 1, 0, width + 1, height);
RoundRectangle2D roundCasing = new RoundRectangle2D.Double(0, 2, width, height - 4, width, width);
Area area = new Area(casing);
area.subtract(new Area(roundCasing));
g2.fill(area);
g2.translate(-trackBounds.x - 2, -trackBounds.y);
} else {
int width = trackBounds.width;
int height = trackBounds.height - 4 + ANTI_WIDTH;
g2.translate(trackBounds.x, trackBounds.y + 2);
Rectangle2D casing = new Rectangle2D.Double(0, 0, width, height);
g2.setColor(Color.BLACK);
float alpha = 0.5f;
Composite composite = g2.getComposite();
if (composite instanceof AlphaComposite) {
alpha *= ((AlphaComposite) composite).getAlpha();
}
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g2.fill(casing);
g2.setComposite(composite);
g2.drawLine(0, -1, width, -1);
g2.drawLine(0, -2, width, -2);
g2.drawLine(0, height, width, height);
g2.drawLine(0, height + 1, width, height + 1);
RoundRectangle2D roundCasing = new RoundRectangle2D.Double(2, 0, width - 4, height, height, height);
Area area = new Area(casing);
area.subtract(new Area(roundCasing));
g2.fill(area);
g2.translate(-trackBounds.x, -trackBounds.y - 2);