use of com.bixly.pastevid.screencap.components.capturebox.Countdown in project screenbird by adamhub.
the class RecorderPanel method startCountdown.
/**
* Initiates countdown and prepares for screen capture.
*/
private void startCountdown() {
final Countdown[] countdown = new Countdown[1];
countdownSec = 6;
countdownTimer = new Timer(500, new ActionListener() {
public void actionPerformed(ActionEvent e) {
countdownSec--;
log("Counting: " + countdownSec);
switch(countdownSec) {
case 0:
countdownTimer.stop();
jLabel5.setText("Recording");
btnRecordNonRec.setText("Stop");
btnRecordRec.setText("Stop");
btnPlayPauseBackup.setText("");
btnPlayPauseBackup.setIcon(pauseIcon);
btnFinalizeBackup.setEnabled(true);
// Destroy the countdown window.
countdown[0].destroy();
try {
Thread.sleep(500);
} catch (Exception ee) {
}
startRecordState();
break;
case 1:
case 2:
case 3:
case 4:
btnPlayPauseBackup.setText(String.valueOf(countdownSec));
countdown[0].destroy();
countdown[0] = new Countdown(false, recorder);
countdown[0].setCount(countdownSec);
countdown[0].setVisible(true);
try {
SoundUtil.tone(880, 500, 0.15);
} catch (LineUnavailableException ee) {
}
break;
case 5:
btnPlayPauseBackup.setText(String.valueOf(countdownSec));
// Hide drop box
if (captureBox != null) {
captureBox.setDragBoxVisible(false);
}
countdown[0] = new Countdown(false, recorder);
countdown[0].setCount(5);
countdown[0].setVisible(true);
try {
SoundUtil.tone(880, 500, 0.15);
} catch (LineUnavailableException ee) {
}
break;
}
}
});
countdownTimer.start();
}
Aggregations