/**
* UI code
* Menampilkan semua code yang sudah dibuat menjadi sebuah aplikasi sederhana
*/
import java.awt.*;
import javax.swing.*;
public class AppFrame extends JFrame
{
public static void main(String[] args)
{
new AppFrame(10);
}
public AppFrame (int duration)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (UnsupportedLookAndFeelException ex) {
}
JFrame frame = new JFrame("Traffic Light");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout(1,1));
frame.add(new TrafficLightPane(duration));
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
}