thomasfelix

PBO 2

Oct 19th, 2020 (edited)
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. import java.awt.*;  
  2. import javax.swing.*;  
  3. import java.awt.event.*;
  4.  
  5. /**
  6.  * Write a description of class Window here.
  7.  * Sebagai tampilan atau interface aplikasi
  8.  * @author Thomas Felix
  9.  * @version 19 Oktober 2020
  10.  */
  11.  
  12. public class Window extends JFrame
  13. {
  14.     public static void main (String[] args)
  15.     {
  16.         new Window(15);
  17.     }
  18.    
  19.     public Window(int durasi)
  20.     {
  21.         EventQueue.invokeLater(new Runnable()
  22.         {
  23.             @Override
  24.             public void run()
  25.             {
  26.                 try
  27.                 {
  28.                     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  29.                 }
  30.                
  31.                 catch (ClassNotFoundException ex) {}
  32.                 catch (InstantiationException ex) {}
  33.                 catch (IllegalAccessException ex) {}
  34.                 catch (UnsupportedLookAndFeelException ex) {}
  35.                
  36.                 JFrame frame = new JFrame("Lampu Lalu Lintas");
  37.                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  38.                 frame.setLayout(new BorderLayout(5, 5));
  39.                
  40.                 frame.add(new Tampilan(durasi));
  41.                 frame.pack();
  42.                 frame.setLocationRelativeTo(null);
  43.                 frame.setVisible(true);
  44.             }
  45.         });
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment