001package headfirst.combined.djview; 002 003import javax.swing.JProgressBar; 004 005@SuppressWarnings("serial") 006public class BeatBar extends JProgressBar implements Runnable { 007 JProgressBar progressBar; 008 Thread thread; 009 010 public BeatBar() { 011 thread = new Thread(this); 012 setMaximum(100); 013 thread.start(); 014 } 015 016 public void run() { 017 for(;;) { 018 int value = getValue(); 019 value = (int)(value * .75); 020 setValue(value); 021 repaint(); 022 try { 023 Thread.sleep(50); 024 } catch (Exception e) {}; 025 } 026 } 027}