Sol - import java.awt import javax.swing import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Sol extends JFrame implements ActionListener { // represents the 7 X 7 borad private int row = 7; private int col = 7; private int[][] board = new int[row][col]; public final static int EMPTY=0; // no piece public final static int OCCUPIED=1; // occupied public final static int NO=-1; private final static int ALLPIECE = 32; private int pieceRemoved = 0; private final static int WAIT_FOR_PIECE = 0; private final static int WAIT_FOR_EMPTY = 1; private int state = WAIT_FOR_PIECE; private int currentI; // row number (i) that is currectly selected by user private int currentJ; // col num (j) that is currectly selected by user private int nextI; // next button private int nextJ; private int middleI; private int middleJ; // file and icons of the images private String occupiedFile = "occupied.gif"; private String emptyFile = "empty.gif"; private Icon occupiedPic = new ImageIcon(occupiedFile); private Icon emptyPic = new ImageIcon(emptyFile); // GUI private JPanel panel = new JPanel(new GridLayout(row, col)); private Container contentPane = getContentPane(); private JButton[][] buttons = new JButton[row][col]; private Color backgroundColor = Color.green.darker(); // background color
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

Sol - import java.awt import javax.swing import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online