user interface - Java: time delay on a specific position - works in the wrong place -


I do not know that the title actually clarifies my problem. I am creating a card game application when users and computers Both of them have closed their card, till then they should remain on the screen in a definite way until the computer closes the next card. I tried try.Sleep () trying to solve this problem in the grip. And it is basically doing what it should have done but it is not what I want to do. The delay is not playing a card between the computer and the second second is off between the user button (for a card) and the on-screen appearance of this card.

Here is the relevant code:

  Private Zero jButton1ActionPerformed (java.awt.event.ActionEvent evt) {jLabel1.setIcon (// new card icon); JPanel1.remove (jButton1); JLabel2.setIcon (// new card icon); If (// to prove that the computer has closed the highest amount) {disableButtons (); Sleep (); // Waiting for a certain time ... Playcard (); // Next Card Closes Down}} Public Nervous Sleep () {try {thread.Sleep (500); } Hold (Interrupted Exception E) {}}  

Welcome to the stack overflow if If you sleep in the UI thread, the UI will not reflect all your drawing commands unless you enter the main loop again. View in


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -