您好我创建了一个黑杰克游戏,当我显示经销商卡我想增加延迟几秒钟前显示每张卡,希望我的代码是足够清楚,感谢任何帮助
private void standBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("DEALER CARD COUNT --- " + dealerCardCount);
dealerCard1.setIcon(new javax.swing.ImageIcon(getClass().getResource(dealerHand[0].img))); // flipping dealer first card
dealerHandSum = calculateHand(dealerHand, dealerCardCount);
jTextSumDealer.setText(String.valueOf(dealerHandSum));
int count = 0;
while(dealerHandSum < 17){ // hiiting a card
dealerCardCount++; // add card to the dealer
dealerHand[dealerCardCount] = getCard();
if(dealerCardCount == 2){ // if its the delaer 3rd card so setting the 3rd lable(card count start from 0)
dealerCard3.setIcon(new javax.swing.ImageIcon(getClass().getResource(dealerHand[dealerCardCount].img)));
}
else if(dealerCardCount == 3){
dealerCard4.setIcon(new javax.swing.ImageIcon(getClass().getResource(dealerHand[dealerCardCount].img)));
}
else if(dealerCardCount == 4){
dealerCard5.setIcon(new javax.swing.ImageIcon(getClass().getResource(dealerHand[dealerCardCount].img)));
}
dealerHandSum = calculateHand(dealerHand, dealerCardCount);
jTextSumDealer.setText(String.valueOf(dealerHandSum));
}
if(playerHandSum > dealerHandSum){
//bp.wallet = bp.wallet - betSum;
Component frame = null;
JOptionPane.showMessageDialog(frame,"YOU WON!", "A plain message", JOptionPane.INFORMATION_MESSAGE);
}
else if(playerHandSum == dealerHandSum){
//bp.wallet = bp.wallet - betSum;
Component frame = null;
JOptionPane.showMessageDialog(frame,"PUSH!", "A plain message", JOptionPane.INFORMATION_MESSAGE);
}
else if(dealerHandSum < 22) {
Component frame = null;
JOptionPane.showMessageDialog(frame,"YOU LOST...", "A plain message", JOptionPane.INFORMATION_MESSAGE);
}
resetGame();
}
暂无答案!
目前还没有任何答案,快来回答吧!