String bTitle = "Run Update Timer";
int interval = getUpdateInterval();
if (interval > 0) {
bTitle = "Reload Data (" + (interval / 1000) + " sec)";
}
timerButton = new JCheckBox(bTitle, getTimer().isRunning());
timerButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JCheckBox check = (JCheckBox) ae.getSource();
Timer t = getTimer();
if (t != null) {
if (check.isSelected()) {
t.restart();
} else {
t.stop();
}
}
}
});
timerButton.setToolTipText("<HTML><BODY>Reload the map data from the original source at specified intervals.</BODY></HTML>");
}
if (autoTimerButton == null) {
autoTimerButton = new JCheckBox("Reload Only When Visible", getAutoTimer());
autoTimerButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JCheckBox check = (JCheckBox) ae.getSource();
setAutoTimer(check.isSelected());
}
});
autoTimerButton.setToolTipText("<HTML><BODY>Only run the timer when the layer is active on the map.</BODY></HTML>");
}