document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * UI code
  3.  * Menampilkan semua code yang sudah dibuat menjadi sebuah aplikasi sederhana
  4.  */
  5.  import java.awt.*;  
  6.  import javax.swing.*;  
  7.  
  8.  public class AppFrame extends JFrame
  9.  {  
  10.    public static void main(String[] args)
  11.    {  
  12.      new AppFrame(10);  
  13.    }  
  14.    
  15.    public AppFrame (int duration)
  16.    {  
  17.      EventQueue.invokeLater(new Runnable()
  18.      {  
  19.        public void run()
  20.        {  
  21.          try
  22.          {  
  23.            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());  
  24.          } catch (ClassNotFoundException ex) {  
  25.          } catch (InstantiationException ex) {  
  26.          } catch (IllegalAccessException ex) {  
  27.          } catch (UnsupportedLookAndFeelException ex) {  
  28.          }  
  29.          
  30.          JFrame frame = new JFrame("Traffic Light");  
  31.          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  32.          frame.setLayout(new BorderLayout(1,1));  
  33.          frame.add(new TrafficLightPane(duration));  
  34.          frame.pack();  
  35.          frame.setLocationRelativeTo(null);  
  36.          frame.setVisible(true);  
  37.        }  
  38.      });  
  39.    }  
  40.  }
');