Unclick JButton by clicking second times
posted 9 months ago
Yes, it is, as people have already told you. But that listener class should be simplified. I don't like to see sources, nor instanceof. I think frequent use of instanceof suggests one is drifting from the principles of object oriented programming. You can pass the Component to colour as a constructor parameter.The use of the & operator is a bit like % 2 but it never returns a negative result, and it is faster than %. The first colour will of course be red, green second.