git test
parent
f3da7c44f7
commit
593ae9901a
|
@ -103,63 +103,6 @@ public class HitoriMain extends JFrame implements AcrtionListener{
|
|||
return pos;
|
||||
}
|
||||
|
||||
public static void backOneStep(Stack<String> movesMade, JButton[][] buttons, String[][] colors, JPanel grid){
|
||||
try {
|
||||
String move = movesMade.pop();
|
||||
String[] line = move.split("\\.");
|
||||
String y = line[0];
|
||||
String x = line[1];
|
||||
String color = line[2];
|
||||
if(color.equals("W")){
|
||||
int i = Integer.parseInt(y);
|
||||
int j = Integer.parseInt(x);
|
||||
JButton b0 = buttons[i][j];
|
||||
b0.setOpaque(true);
|
||||
b0.setForeground(Color.WHITE);
|
||||
b0.setContentAreaFilled(true);
|
||||
b0.setBorderPainted(false);
|
||||
b0.setFocusPainted(false);
|
||||
b0.setBackground(Color.BLACK);
|
||||
buttons[i][j] = b0;
|
||||
String str = colors[i][j];
|
||||
String str0 = str.substring(0, str.length() - 1);
|
||||
colors[i][j] = str0;
|
||||
grid.repaint();
|
||||
gridUpdate(grid, buttons);
|
||||
}else if(color.equals("G")){
|
||||
int i = Integer.parseInt(y);
|
||||
int j = Integer.parseInt(x);
|
||||
JButton b0 = buttons[i][j];
|
||||
b0.setOpaque(true);
|
||||
b0.setForeground(Color.BLACK);
|
||||
b0.setContentAreaFilled(true);
|
||||
b0.setBorderPainted(false);
|
||||
b0.setFocusPainted(false);
|
||||
b0.setBackground(Color.WHITE);
|
||||
buttons[i][j] = b0;
|
||||
String str = colors[i][j];
|
||||
String str0 = str.substring(0, str.length() - 1);
|
||||
colors[i][j] = str0;
|
||||
gridUpdate(grid, buttons);
|
||||
} else if(color.equals("B")){
|
||||
int i = Integer.parseInt(y);
|
||||
int j = Integer.parseInt(x);
|
||||
JButton b0 = buttons[i][j];
|
||||
b0.setOpaque(true);
|
||||
b0.setForeground(Color.BLACK);
|
||||
b0.setContentAreaFilled(true);
|
||||
b0.setBorderPainted(false);
|
||||
b0.setFocusPainted(false);
|
||||
b0.setBackground(Color.lightGray);
|
||||
buttons[i][j] = b0;
|
||||
String str = colors[i][j];
|
||||
String str0 = str.substring(0, str.length() - 1);
|
||||
colors[i][j] = str0;
|
||||
gridUpdate(grid, buttons);
|
||||
}
|
||||
} catch(EmptyStackException e) {}
|
||||
}
|
||||
|
||||
public static void totalResetButton(JButton[][] buttons, String[][] colors,Stack<String> madeMoves,String[][] data){
|
||||
madeMoves.clear();
|
||||
for(int i = 0; i<data.length;i++){
|
||||
|
|
Loading…
Reference in New Issue