Java code to display a GUI

Hi members,I would like to share knowlege in Java with you.
I have a problem which i request a solution for.
I want to design a GUI in java that displays four roads each having traffic
lights and these traffic lights have four colours(green, orange, and Red).
So I want these traffic lights to change colours every after 10 seconds with green
moving clockwise to all the four roads followed by orange and
finally Red. This code should allow me to click on any these lights and when I do so
the clicked traffic light should light up green all the rest light up red immediately.

Hi members,I would like to share knowlege in Java with you.
I have a problem which i request a solution for.
I want to design a GUI in java that displays four roads each having traffic
lights and these traffic lights have four colours(green, orange, and Red).
So I want these traffic lights to change colours every after 10 seconds with green
moving clockwise to all the four roads followed by orange and
finally Red. This code should allow me to click on any these lights and when I do so
the clicked traffic light should light up green all the rest light up red immediately.

Please use code tags when you post code for review. As for the code, what question do you have about it? The fact that it doesn't return the correct string description? Hint: don't try to use a 1-based state variable backed by a zero-based array. (There's also no reason to re-create that array in every call to "toString()" ).

If you are representing state with integer state codes, you should define those as named constants as well. "RED" makes a lot more sense to read in the code than "1". Using an enum would probably be even better.