'Is there a way to simply this line of code?

This line of code is literally just a 10 to 1 countdown using applets in java and I was just wondering if there is a much simpler way to write this instead of writing the same code structure 10 times over. After the text is displayed, a delay is also taken place.

   public void mouseDown (int x, int y){
       Graphics g = getScreenBuffer(); 
       g.setColor(Color.red);
       g.drawRect(250, 610, 200, 60);
       g.setColor(Color.white);
       String txt = "BLAST OFF";
       
       if (250<=x && x<=450 && 610<=y && y<=670) {

        
       g.drawString(txt, 325, 645);
       String count1 = "10";
       g.drawString(count1, 50, 50);
       repaint();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Exercise43.class.getName()).log(Level.SEVERE, null, ex);
        }
        String count2 = "9";
        g.drawString(count2, 50, 100); 
       repaint();
       try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Exercise43.class.getName()).log(Level.SEVERE, null, ex);
        }
        String count3 = "8";
        g.drawString(count3, 50, 150); 
       repaint();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
          
        }
       System.exit(0);
   }
}
}
 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source