Advertisement
mnaufaldillah

AppFrame Tugas 2

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