import java.awt.*; import java.applet.*; import java.awt.event.*; /* <applet code="traffic.class" width=500 height=500> </applet> */ public class traffic extends Applet implements ActionListener { int i=0; Button R,O,G; public void init() { setBackground(Color.white); setForeground(Color.black); R=new Button("red"); O=new Button("orange"); G=new Button("green"); add(R); add(O); add(G); R.addActionListener(this); O.addActionListener(this); G.addActionListener(this); } public void actionPerformed(ActionEvent ae) { String s=ae.getActionCommand(); if(s.equals("red")) i=1; if(s.equals("orange")) i=2; if(s.equals("green")) i=3; repaint(); } public void paint(Graphics g) { g.setColor(Color.yellow); g.drawRect(50,50,100,200); g.fillRect(50,50,100,200); g.setColor(Color.black); g.drawOval(80,70,30,30); g.drawOval(80,130,30,30); g.drawOval(80,190,30,...