KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > pooka > gui > LoadMessageTracker


1 package net.suberic.pooka.gui;
2
3 import net.suberic.pooka.event.*;
4 import javax.swing.JProgressBar JavaDoc;
5
6 /**
7  * This is a JProgressBar which is also a MessageLoadedListener. It can be
8  * used to show the count of messages as they are loaded (not surprisingly).
9  */

10
11 public class LoadMessageTracker extends JProgressBar JavaDoc implements MessageLoadedListener {
12     
13   private int initialValue;
14   
15   public LoadMessageTracker(int newInitialValue) {
16     super();
17     initialValue=newInitialValue;
18   }
19   
20   public LoadMessageTracker(int newInitialValue, int newMin, int newMax) {
21     super(newMin, newMax);
22     initialValue=newInitialValue;
23   }
24   
25   /**
26    * Defined in net.suberic.pooka.event.MessageLoadedListener
27    */

28   public void handleMessageLoaded(MessageLoadedEvent e) {
29     if (e.getNumMessages() != this.getMaximum())
30       this.setMaximum(e.getNumMessages());
31     setValue(this.getValue() + e.getLoadedMessageCount());
32     //if (getValue() == getMaximum())
33
// if (this.getParent() != null)
34
// this.getParent().remove(this);
35
}
36 }
37
38
Popular Tags