Class TrafficLight

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

@ResourceDependency({"resource-files/traffic-red.png","resource-files/traffic-yellow.png","resource-files/traffic-green.png","resource-files/traffic-all.png","resource-files/traffic-none.png"}) public class TrafficLight extends JLabel
A graphic object showing a traffic light in different phases.

The appearance of the traffic light can altered by calling setState(State). This is used by TrafficMessageReceiver

See Also:
  • Field Details

    • SOURCE_URL

      public static final String SOURCE_URL
      The web adress where the clipart had been copied from. (see also "http://www.openclipart.org/cgi-bin/navigate/signs_and_symbols?page=7")
      See Also:
  • Constructor Details

  • Method Details

    • getState

      public TrafficLight.State getState()
      Return the current state of the traffic light
      Returns:
      the current state of the traffic light
    • setState

      public void setState(TrafficLight.State state)
      Changes the state and creates a Swing thread for updating the visual.
      Parameters:
      state - to be shown by the traffic light