How to create a delay in Swing
问题 I made a blackjack game, and I want the AI player to pause between taking cards. I tried simply using Thread.sleep(x), but that makes it freeze until the AI player is done taking all of his cards. I know that Swing is not thread safe, so I looked at Timers, but I could not understand how I could use one for this. Here is my current code: while (JB.total < 21) { try { Thread.sleep(1000); } catch (InterruptedException ex) { System.out.println(\"Oh noes!\"); } switch (getJBTable(JB.total, JB