I believe this code is written well. It compiled with no errors.
1. I need help creating a decrementing timer pause of 1 sec.
2. I also need to make sure the existing pane closes when the new one opens.
I have been reading and I assume it has something to do with swing.timer but am unsure on how to plug this into the while statement.
import javax.swing.JOptionPane; public class Timer{ public static void main(String[] args){ String calculateDayString = JOptionPane.showInputDialog("Countdown Timer Enter How Many Days: "); int inputDay = Integer.parseInt(calculateDayString); int calculateDaySeconds = inputDay * 8640; String calculateHourString = JOptionPane.showInputDialog("Countdown Timer Enter How Many Hours: "); int inputHour = Integer.parseInt(calculateHourString); int calculateHourSeconds = inputHour * 360; String calculateMinuteString = JOptionPane.showInputDialog("Countdown Timer Enter How Many Minutes: "); int inputMinute = Integer.parseInt(calculateMinuteString); int calculateMinuteSeconds = inputMinute * 60; String calculateSecondString = JOptionPane.showInputDialog("Countdown Timer Enter How Many Seconds: "); int calculateSeconds = Integer.parseInt(calculateSecondString); String secondsRemainingString = calculateDaySeconds + calculateHourSeconds + calculateMinuteString + calculateSeconds; int secondsRemaining = Integer.parseInt(secondsRemainingString); while (secondsRemaining > 0) { secondsRemaining--; System.out.print("You Have " + secondsRemaining); } System.out.print("Zero Seconds Timer Stopped"); } }