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.7 by tdb, Tue May 21 16:47:10 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org.uk
4 + * Copyright (C) 2000-2002 i-scream
5 + *
6 + * This program is free software; you can redistribute it and/or
7 + * modify it under the terms of the GNU General Public License
8 + * as published by the Free Software Foundation; either version 2
9 + * of the License, or (at your option) any later version.
10 + *
11 + * This program is distributed in the hope that it will be useful,
12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 + * GNU General Public License for more details.
15 + *
16 + * You should have received a copy of the GNU General Public License
17 + * along with this program; if not, write to the Free Software
18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + */
20 +
21   //---PACKAGE DECLARATION---
22 < package uk.ac.ukc.iscream.conient;
22 > package uk.org.iscream.cms.conient;
23  
24   //---IMPORTS---
25   import javax.swing.JProgressBar;
26 + import javax.swing.JPanel;
27 + import javax.swing.JLabel;
28 + import javax.swing.BoxLayout;
29   import javax.swing.SwingUtilities;
30  
31   /**
# Line 19 | Line 42 | import javax.swing.SwingUtilities;
42   * @author  $Author$
43   * @version $Id$
44   */
45 < public class PacketTimer extends JProgressBar implements Runnable {
45 > public class PacketTimer extends JPanel implements Runnable {
46  
47   //---FINAL ATTRIBUTES---
48  
# Line 37 | Line 60 | public class PacketTimer extends JProgressBar implemen
60       *
61       * @param timeBetweenPackets the time in seconds between packet arrival
62       */
63 <    public PacketTimer(int timeBetweenPackets) {
41 <        super(JProgressBar.VERTICAL, 0, (timeBetweenPackets * 10) + 1);
63 >    public PacketTimer(String name, int timeBetweenPackets) {
64          _timeBetweenPackets = timeBetweenPackets * 10;
65 <        setMaximum(_timeBetweenPackets);
65 >        _progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, _timeBetweenPackets);
66 >        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
67 >        JLabel label = new JLabel(name);
68 >        this.add(_progressBar);
69 >        this.add(label);
70      }
71  
72   //---PUBLIC METHODS---
# Line 57 | Line 83 | public class PacketTimer extends JProgressBar implemen
83              
84              SwingUtilities.invokeLater(new Runnable() {
85                  public void run() {
86 <                    PacketTimer.this.setValue(PacketTimer.this.getValue() - 1);
86 >                    _progressBar.setValue(_progressBar.getValue() - 1);
87                  }
88              });
89          }
# Line 69 | Line 95 | public class PacketTimer extends JProgressBar implemen
95      public void reset() {
96          SwingUtilities.invokeLater(new Runnable() {
97              public void run() {
98 <                PacketTimer.this.setValue(_timeBetweenPackets);
98 >                _progressBar.setValue(_timeBetweenPackets);
99              }
100          });
101      }
# Line 89 | Line 115 | public class PacketTimer extends JProgressBar implemen
115       * Used to indicate the state of the thread
116       */
117      private boolean _running = true;
118 +    
119 +    private JProgressBar _progressBar;
120  
121   //---STATIC ATTRIBUTES---
122  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines