我建立一個連接四個遊戲,這是我的檢查:如何檢查整列?
static final int ROWS = 6;
public void checkIfFull(int colu)
{
/*deleted*/
}
這是當用戶點擊一個按鈕調用:
if (e.getSource() == b1)
{
checkIfFull (0);
}
這是我的方法在定位令牌最低開等級:
public void setPos(int column)
{
if (demise) return; //this is for when the game is already over and the user
still attempts to click on a button
int row;
for (row = 0; row < ROWS; ++row)
{
if (slots[row][column] > 0)
break;
}
if (row > 0)
{
//save current player
slots[--row][column] = active;
//change turns
/*if (active == GREEN)
{
active = RED;
activeMe();
}
else if (active == RED)
{
active = GREEN;
activeMe();
} I moved this to setCircle method*/
setCircle(active, row, column); //gui method used to fill up the empty circle
}
}
,當我填寫了一欄的一瞬間,在JOptionPane中不會彈出,但它應該。
任何線索?
我仍在不斷研究我的邏輯,所以如果還有其他缺陷可以看到,請將它們指出來。 :)
#1更具體的問題。你遇到的問題是什麼?您是否收到錯誤(如果是這樣,請發佈堆棧跟蹤)?你是否觀察到意想不到的行爲,如果是,它是什麼,以及期望的行爲是什麼? –
@Teeg對不起,應該更具體。此刻joptionpane應該彈出列滿時彈出,但它不 – user3026693
@HovercraftFullOfEels yep只是做 – user3026693