Let's start/stop the timer when the panel is added/removed.
This commit is contained in:
@@ -63,7 +63,7 @@ public class StatusPanel extends JComponent
|
|||||||
|
|
||||||
// Add a bit of "throbbing" to the display by updating the number of dots displayed after
|
// Add a bit of "throbbing" to the display by updating the number of dots displayed after
|
||||||
// our status. This lets users know things are still working.
|
// our status. This lets users know things are still working.
|
||||||
new Timer(1000,
|
_timer = new Timer(1000,
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
public void actionPerformed (ActionEvent event) {
|
public void actionPerformed (ActionEvent event) {
|
||||||
if (_status != null && !_displayError) {
|
if (_status != null && !_displayError) {
|
||||||
@@ -71,7 +71,7 @@ public class StatusPanel extends JComponent
|
|||||||
updateStatusLabel();
|
updateStatusLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init (UpdateInterface ifc, RotatingBackgrounds bg, Image barimg)
|
public void init (UpdateInterface ifc, RotatingBackgrounds bg, Image barimg)
|
||||||
@@ -153,6 +153,20 @@ public class StatusPanel extends JComponent
|
|||||||
updateStatusLabel();
|
updateStatusLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNotify ()
|
||||||
|
{
|
||||||
|
super.addNotify();
|
||||||
|
_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeNotify ()
|
||||||
|
{
|
||||||
|
_timer.stop();
|
||||||
|
super.removeNotify();
|
||||||
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent (Graphics g)
|
public void paintComponent (Graphics g)
|
||||||
@@ -353,6 +367,7 @@ public class StatusPanel extends JComponent
|
|||||||
protected Label _rlabel, _newrlab;
|
protected Label _rlabel, _newrlab;
|
||||||
|
|
||||||
protected UpdateInterface _ifc;
|
protected UpdateInterface _ifc;
|
||||||
|
protected Timer _timer;
|
||||||
|
|
||||||
protected long[] _remain = new long[4];
|
protected long[] _remain = new long[4];
|
||||||
protected int _ridx;
|
protected int _ridx;
|
||||||
|
|||||||
Reference in New Issue
Block a user