3 import java.awt.FlowLayout;
5 import javax.swing.BorderFactory;
6 import javax.swing.JLabel;
7 import javax.swing.JPanel;
8 import tim.prune.DataSubscriber;
11 * Class to act as a status bar for the application
13 public class StatusBar extends JPanel implements Runnable, DataSubscriber
15 /** Label for displaying the text */
16 private JLabel _label = null;
17 /** timer for clearing the status */
18 private long _timer = 0L;
19 /** thread for clearing the status */
20 private Thread _thread = null;
22 /** Number of milliseconds until status text cleared */
23 private static final long DEFAULT_CLEAR_INTERVAL = 1000L * 4;
31 setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
32 setBorder(BorderFactory.createLoweredBevelBorder());
33 _label = new JLabel(" ");
34 _label.setFont(_label.getFont().deriveFont(8));
39 * Run method, to check if text should be deleted
40 * @see java.lang.Runnable#run()
44 while (System.currentTimeMillis() < _timer) {
48 catch (InterruptedException ie) {} // ignore
54 * Accept notification that an action has been completed
55 * @param inMessage message to display
57 public void actionCompleted(String inMessage)
59 _label.setText(" " + inMessage);
60 _timer = System.currentTimeMillis() + DEFAULT_CLEAR_INTERVAL;
61 // If necessary, start a new checker thread
62 if (_thread == null || !_thread.isAlive()) {
63 _thread = new Thread(this);
69 * Ignore signals about updated data
70 * @param inUpdateType update type
72 public void dataUpdated(byte inUpdateType)