added array methods for buttons and colors
parent
c7fcabd287
commit
9e294e1c2d
|
@ -49,4 +49,27 @@ public class HitoriMain extends JFrame implements AcrtionListener{
|
|||
sc.close();
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public static String[][] makeColorArray(int size){
|
||||
String[][] colors = new String[size][size];
|
||||
for(int i=0;i<size;i++){
|
||||
for(int j=0;j<size;j++){
|
||||
colors[i][j] = "W";
|
||||
}
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public static JButton[][] makeButtonArray(String[][] data){
|
||||
JButton[][] buttons = new JButton[data.length][data.length];
|
||||
for(int i=0;i<data.length;i++){
|
||||
for(int j=0;j<data.length;j++){
|
||||
String number = data[i][j];
|
||||
JButton b0 = new JButton(number);
|
||||
buttons[i][j] = b0;
|
||||
}
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue