Guest User

App Frame

a guest
Oct 16th, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1.  
  2.  /**  
  3.   * Class untuk menampilkan WindowFrame aplikasi  
  4.   */  
  5.  import java.awt.*;  
  6.  import javax.swing.*;  
  7.  public class AppFrame extends JFrame{  
  8.    public static void main(String[] args) {  
  9.      new AppFrame(60);  
  10.    }  
  11.    public AppFrame (int duration){  
  12.      EventQueue.invokeLater(new Runnable() {  
  13.        public void run() {  
  14.          try {  
  15.            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());  
  16.          } catch (ClassNotFoundException ex) {  
  17.          } catch (InstantiationException ex) {  
  18.          } catch (IllegalAccessException ex) {  
  19.          } catch (UnsupportedLookAndFeelException ex) {  
  20.          }  
  21.          JFrame frame = new JFrame("Traffic Light");  
  22.          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  23.          frame.setLayout(new BorderLayout(1,1));  
  24.          frame.add(new TrafficLightPane(duration));  
  25.          frame.pack();  
  26.          frame.setLocationRelativeTo(null);  
  27.          frame.setVisible(true);  
  28.        }  
  29.      });  
  30.    }  
  31.  }
Advertisement
Add Comment
Please, Sign In to add comment