Commit 21009d47 authored by 9611046's avatar 9611046

getMyX(),getMyY() method in square completed and isChecked completed in main

parent 976acca3
This diff is collapsed.
......@@ -10,8 +10,8 @@ import java.awt.*;
*/
public class Square extends JButton {
int x;
int y;
private int x;
private int y;
private Piece piece;
private boolean isSelected = false;
private boolean hasPiece = false;
......@@ -30,6 +30,14 @@ public class Square extends JButton {
}
public int getMyX() {
return x;
}
public int getMyY(){
return y;
}
public JLabel getImage() {
return image;
}
......
......@@ -35,7 +35,7 @@ public class King extends Piece {
public ArrayList<Square> move(Square[][] squares, int x, int y){
//The java.util.ArrayList.clear() method removes all of the elements from this list.The list will be empty after this call returns.
ArrayList<Square> possibleSquares=new ArrayList<>();
possibleSquares.clear();
int posx[]={x,x,x+1,x+1,x+1,x-1,x-1,x-1};
int posy[]={y-1,y+1,y-1,y,y+1,y-1,y,y+1};
for(int i=0;i<8;i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment