import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class GamePiece extends JButton implements MouseListener {
    private int status;
    private Image blackCircle;
    private Image whiteCircle;
    private Image transparentCircle;
    public GamePiece() {
        setStatus(0);
        setBorder(BorderFactory.createEmptyBorder());//Remove all borders
        try {
            blackCircle = ImageIO.read(getClass().getResource("black circle.png"));
            whiteCircle = ImageIO.read(getClass().getResource("white circle.png"));
            transparentCircle = ImageIO.read(getClass().getResource("transparent circle.png"));
        }catch(IOException e){
            System.out.println("IO Exception" + e);
        }
        addMouseListener(this);
    }

    public void setStatus(int _status){
        if(_status < 4 && _status >= 0){
            status = _status;
            if(status == 0) {
                //set icon to not glow
            }else if(status == 1){
                //set icon to glow
                //clear Icon
            }else if(status == 2){
                //set Icon to black
                //Clear Icon
                setIcon(new ImageIcon(blackCircle));
            }else if(status == 3){
                //set Icon to white
                setIcon(new ImageIcon(whiteCircle));
            }
        }else{
            System.out.println("Status set error, status entered: " + _status);
        }
    }

    public int getStatus(){
        return status;
    }

    /*
    * Mouse events
    * When a space is a valid move (status 1), add transparent circle
     */
    public void mouseReleased(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseClicked(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {
        if(status == 1){
            setIcon(new ImageIcon(transparentCircle));
        }
    }
    public void mouseExited(MouseEvent e) {
        if(status == 1){
            setIcon(null);
        }
    }
}
@@ -344,16 +344,63 @@
 tus(0);%0A
+        setModel(new FixedStateButtonModel());%0A
         
@@ -939,10 +939,11 @@
 us %3C
- 4
+= 3
  && 
@@ -956,16 +956,62 @@
 s %3E= 0)%7B
+//Check that status is a valid number from 0-3
 %0A       
@@ -1063,72 +1063,12 @@
 == 0
-) %7B%0A                //set icon to not glow%0A            %7Delse if(
+ %7C%7C 
 stat
@@ -1067,32 +1067,33 @@
  %7C%7C status == 1)
+ 
 %7B%0A              
@@ -1100,24 +1100,18 @@
   //
-set icon to glow
+Clear Icon
 %0A   
@@ -1127,20 +1127,22 @@
     
-//clear Icon
+setIcon(null);
 %0A   
@@ -1213,37 +1213,8 @@
 ack%0A
-                //Clear Icon%0A
     
@@ -2067,8 +2067,272 @@
 %0A    %7D%0A%7D
+%0A%0A/*%0A* Extends the default settings for a JButton%0A* Disables button highlighted on press%0A */%0Aclass FixedStateButtonModel extends DefaultButtonModel    %7B%0A    public boolean isPressed() %7B%0A        return false;//forces button to never highlight when pressed%0A    %7D%0A%7D%0A%0A

Disable Highlight on press