Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public class Window {
  2.  
  3.     public static final int WIDTH = 307, HEIGHT = 630;
  4.     private JFrame window;
  5.     private Board board;
  6.  
  7.     public Window(){
  8.         window = new JFrame("Tetris Game");
  9.         window.setSize(WIDTH, HEIGHT);
  10.         window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11.         window.setResizable(false);
  12.         window.setLocationRelativeTo(null);
  13.  
  14.         board = new Board();
  15.         window.add(board);
  16.  
  17.         window.setVisible(true);
  18.     }
  19.  
  20.  
  21.  
  22.     public static void main(String[] args) {
  23.         new Window();
  24.     }
  25. }
  26.  
  27.  
  28. public class Board extends JPanel {
  29.  
  30.     public Board(){
  31.  
  32.     }
  33.  
  34.    @Override
  35.     public void paintComponents(Graphics g) {
  36.        g.setColor(Color.RED);
  37.        g.fillRect(0, 0, 300,600);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement