I'm working with JLabels and Colors but it seems like I failed somewhere with the coding.
In my application every necessary class is imported and extended, implented in the class.
Here's the bad part of the code which causes the error:
...
public void mouseEntered(MouseEvent e) {
for (int i = 0; i < m.length; i++) {
if(e.getSource() == m[i]) {
Color current = Color.getColor(mLabel[i]);
rHover = current.getRed();
...
}
}
}
...
variables declared as:
m[] is a JLabel array
mLabel[] is a String array
rHover is an integer.
I guess I've told every necessary information, if not, please tell me. I've tried doing this in different ways, but none of them succeeded. This current code can be compiled, so there is no syntax error.
What I want, in short, is a really simple hover effect for any colored JLabel. As told before, m[] is the JLabel array and mLabel[] array contains the Texts for each JLabel. I wanted to get the color of these Strings and change them on MouseEnter.
What am I doing wrong?

Please help me.