Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import javax.swing.JPanel;
  4.  
  5.  
  6. public class JWhiteBoard extends JPanel {
  7.  
  8.     private int rows = 10;
  9.     private int cols = 10;
  10.    
  11.     public void paintComponent(Graphics g) {
  12.         for (int i=0;i<cols;i++){
  13.             for (int j=0;j<rows;j++){
  14.                 g.drawOval(i*10,j*10,10,10);
  15.             }
  16.         }  
  17.     }
  18.  
  19.     public void setRows(int i) {
  20.         rows = i;
  21.     }
  22.  
  23.     public void setCols(int i) {
  24.         cols = i;
  25.     }
  26.    
  27.  
  28.    
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement