@Override
protected void paintComponent(Graphics g) {
int width = getWidth(), height = getHeight();
Graphics2D g2d = (Graphics2D) g.create();
if (alpha < 1.0f) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
}
if (currentImage != null) {
GraphicsConfiguration gc = getGraphicsConfiguration();
if (gc.getClass() != graphicsConfigClass) {
graphicsConfigClass = gc.getClass();
updateRenderingHints(graphicsConfigClass);
}
if (!renderingHints.isEmpty()) {
g2d.setRenderingHints(renderingHints);
}
render(g2d, 0, 0, width, height);
} else if (alpha >= 1.0f) {
g2d.setColor(getBackground());
g2d.fillRect(0, 0, width, height);
}
g2d.dispose();
}
@Override