In my problem, I have an opaque JPanel and another JPanel that is translucent (translucent) that sits on the first JPanel. When I added radio buttons to the top panel of JPanel. The problem is that every time I find the mouse over the label area of ββeach switch (and every time I move the mouse from the label), it gets darker and darker.
package trial; import java.awt.Color; import javax.swing.ButtonGroup; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JRadioButton; public class Test { public static void main(String arg[]){ JFrame rootframe = new JFrame("Test panel"); rootframe.setSize(800, 550); rootframe.setExtendedState(JFrame.MAXIMIZED_BOTH); JPanel basePanel = new JPanel();
I believe that this is not a problem with the switches, because in another case, I noticed that in the same conditions, if I added JLabel to the top JPanel and added listeners to the top panel, so that the color of the jLabel text will change when you mouse over and reset to the original color, when the mouse exits, the text will be redrawn in different places, as shown in the image below: -
If necessary, I will send this code too. I think this is the same problem as in both cases.
source share