Java Swing JButton Time Delays (Flicker)
问题 I am trying to make my JButton flicker red for this game I am creating. All the solutions on this website suggest using a thread and putting it to sleep or using a timer, however, the pause allays seems to come after the color change Here is my code: Color cb = board[Y1][X1].getBackground(); board[Y1][X1].setBackground(Color.RED); //Pause board[Y1][X1].setBackground(cb); If I put a thread and put it to sleep on line 3 and comment out line 4 the pause will come before the JButton is turned red