Advertisement
Vita_Harvey

Cell_A

Feb 24th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. package csc143.sudoku;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. /**
  7.  * @author Vita Wiebe
  8.  * @version PA2
  9.  * A helper class to make a cell inside a SudokuBoard object.
  10.  */
  11. public class Cell extends JPanel {
  12.          
  13.      /** Our class constructor.
  14.       * Determines size and shape of Cell object, which has
  15.       * been standardized for the purposes of this assignment.
  16.       * @param int row, int column, used to keep board position.
  17.       */
  18.      public Cell(int row, int column) {        
  19.        
  20.          setPreferredSize(new Dimension(50, 50));    
  21.          //add(new JLabel(column + ", " + row));
  22.          setOpaque(false);
  23.          setEnabled(true);        
  24.      }
  25.      
  26.     /**
  27.      * This method renders one 50x50 "cell" to add to cell array "cells".
  28.      * @param g The Graphics object use to render
  29.      */
  30.     @Override
  31.     public void paintComponent(java.awt.Graphics g) {
  32.        
  33.         // paint the underlying component
  34.         super.paintComponent(g);
  35.                              
  36.         // set the color of the outline        
  37.         g.setColor(Color.BLACK);
  38.                
  39.         g.drawRect(0, 0, 47, 47);
  40.                        
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement