Class TrafficLight

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

@ResourceDependency({"resource-files/traffic-red.png","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

    • sourceURL

      public static final String sourceURL
      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

    • TrafficLight

      public TrafficLight()
      Creates a new traffic light object and set its state to TrafficLight.State.all.
    • TrafficLight

      public TrafficLight(TrafficLight.State state)
      Creates a new traffic light object and set its state.
  • Method Details

    • getState

      public TrafficLight.State getState()
      Evident
    • setState

      public void setState(TrafficLight.State state)
      Changes the state and creates a Swing thread for updating the visual.