Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an Alarm GUI with a text field where user can enter time in milliseconds (ms) and two buttons, one for play and another for
Create an Alarm GUI with a text field where user can enter time in milliseconds (ms) and two buttons, one for play and another for pause that enables and disables the alarm. The alarm is supposed to beep after the user-specified time interval. Create a class TimerAlarm that extends Thread and implements a timer. Do not use the built-in Timer class for this exercise. Your class constructor should take as input an integer named t representing time in ms and an interface object named obj that defines a method named alarmAction(). You will need to define this interface. Every t milliseconds the class should invoke method obj.alarmAction). Add pause0 and playO methods that disable and enable the invocation of alarmAction0. Test you class with the following code that generates a beep sound in alarmAction method Toolkit.getDefaultToolkit().beep(); // import import java.awt.Toolkit; Create an Alarm GUI with a text field where user can enter time in milliseconds (ms) and two buttons, one for play and another for pause that enables and disables the alarm. The alarm is supposed to beep after the user-specified time interval. Create a class TimerAlarm that extends Thread and implements a timer. Do not use the built-in Timer class for this exercise. Your class constructor should take as input an integer named t representing time in ms and an interface object named obj that defines a method named alarmAction(). You will need to define this interface. Every t milliseconds the class should invoke method obj.alarmAction). Add pause0 and playO methods that disable and enable the invocation of alarmAction0. Test you class with the following code that generates a beep sound in alarmAction method Toolkit.getDefaultToolkit().beep(); // import import java.awt.Toolkit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started