ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/PacketTimer.java
(Generate patch)

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/PacketTimer.java (file contents):
Revision 1.2 by ajm, Sun Feb 4 20:34:05 2001 UTC vs.
Revision 1.5 by tdb, Tue May 29 17:41:32 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.conient;
2 > package uk.org.iscream.cms.conient;
3  
4   //---IMPORTS---
5   import javax.swing.JProgressBar;
6 + import javax.swing.JPanel;
7 + import javax.swing.JLabel;
8 + import javax.swing.BoxLayout;
9   import javax.swing.SwingUtilities;
10  
11   /**
# Line 19 | Line 22 | import javax.swing.SwingUtilities;
22   * @author  $Author$
23   * @version $Id$
24   */
25 < public class PacketTimer extends JProgressBar implements Runnable {
25 > public class PacketTimer extends JPanel implements Runnable {
26  
27   //---FINAL ATTRIBUTES---
28  
# Line 37 | Line 40 | public class PacketTimer extends JProgressBar implemen
40       *
41       * @param timeBetweenPackets the time in seconds between packet arrival
42       */
43 <    public PacketTimer(int timeBetweenPackets) {
41 <        super(JProgressBar.VERTICAL, 0, (timeBetweenPackets * 10) + 1);
43 >    public PacketTimer(String name, int timeBetweenPackets) {
44          _timeBetweenPackets = timeBetweenPackets * 10;
45 <        setMaximum(_timeBetweenPackets);
45 >        _progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, _timeBetweenPackets);
46 >        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
47 >        JLabel label = new JLabel(name);
48 >        this.add(_progressBar);
49 >        this.add(label);
50      }
51  
52   //---PUBLIC METHODS---
# Line 57 | Line 63 | public class PacketTimer extends JProgressBar implemen
63              
64              SwingUtilities.invokeLater(new Runnable() {
65                  public void run() {
66 <                    PacketTimer.this.setValue(PacketTimer.this.getValue() - 1);
66 >                    _progressBar.setValue(_progressBar.getValue() - 1);
67                  }
68              });
69          }
# Line 69 | Line 75 | public class PacketTimer extends JProgressBar implemen
75      public void reset() {
76          SwingUtilities.invokeLater(new Runnable() {
77              public void run() {
78 <                PacketTimer.this.setValue(_timeBetweenPackets);
78 >                _progressBar.setValue(_timeBetweenPackets);
79              }
80          });
81      }
# Line 89 | Line 95 | public class PacketTimer extends JProgressBar implemen
95       * Used to indicate the state of the thread
96       */
97      private boolean _running = true;
98 +    
99 +    private JProgressBar _progressBar;
100  
101   //---STATIC ATTRIBUTES---
102  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines