title: Open card after certain time
body: <p>i'm programming a blackjack (single thread) for a university project and the dealer is the computer (e.g. no player action)...</p>
  
  <p>Does someone know how can I program in Java something like this:</p>
  
  <pre><code>while (dealerpoints &lt; 17)
      open card and repaint frame
      wait 1 sec (to run again the condition test for while)
  </code></pre>
  
  <p>THe thing is, I don't want all dealer cards painted at once...</p>
  
  <p>Thanks in advance,
  Gabriel Sotero</p>
  
  <p>UPDATE: this is my code (that doesn't work)</p>
  
  <pre><code>        while (Dealer.getInstance().dealerPoints &lt; 17){
  
              Dealer.getInstance().openCard();
              try {
                  Thread.sleep(100);
              }
              catch (InterruptedException e){ }
          }
  </code></pre>
  
  <p>openCard declaration:</p>
  
  <pre><code>    private void openCard(){
  
          Card temp;
  
          temp = Deck.getInstance().myPop();
          Dealer.getInstance().cards.add(temp);
          Dealer.getInstance().dealerPoints += temp.getValue(); 
          MainPanel.getInstance().updateDealerLabel(Dealer.getInstance().dealerPoints);
          MainPanel.getInstance().repaint();
  
      }
  </code></pre>