I have set my the container JPanel's background color partially transparent. I have a JLabel on it with a PNG image that has a transparent background. I have another image as well which is shown when mouse is over the label. I use the following to change the icon
private void settingsMouseEntered(java.awt.event.MouseEvent evt) {
this.settings.setIcon(new ImageIcon(getClass().getResource("/Resources/settingsIconHover.png")));
}
private void settingsMouseExited(java.awt.event.MouseEvent evt) {
this.settings.setIcon(new ImageIcon(getClass().getResource("/Resources/settingsIcon.png")));
}
It changes the opacity a little bit every time the icon is updated. Eventually the background isn't transparent anymore.
I have set the JPanel's background with the following code
content.setBackground(new Color(74, 137, 227, 60));
The JPanel is in a JFrame which has also a specific background
setBackground(new Color(74, 137, 227, 80));
Here's an image
What is wrong?