Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.awt.image.BufferedImage;
  3. import javax.swing.JPanel;
  4.  
  5. public class Plansza extends JPanel {
  6.  
  7. private BufferedImage klocki;
  8. private final int blockSize=30;
  9. private final int boardWidth=10;
  10. private final int boardHeight=20;
  11. private int[][] board = new int[boardWidth][boardHeight];
  12.  
  13.  
  14.  
  15. public void paintComponent(Graphics g) {
  16. super.paintComponent(g);
  17. for(int i=0; i<boardHeight; i++) {
  18. g.drawLine(0, i*blockSize, boardWidth*blockSize, i*blockSize);
  19. }
  20. for(int j=0;j<boardWidth;j++) {
  21. g.drawLine(j*blockSize, 0, j*blockSize, boardHeight*blockSize);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement