Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. limer For this exercise, you will need to make an application that has a Graphical User Interface that represents a timer. Template files Controller.java

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1. limer For this exercise, you will need to make an application that has a Graphical User Interface that represents a timer. Template files Controller.java o Timer.java View.java Text View.java o GraphicalView.java The Timer has 6 buttons, one that will increase and one that decreases hours, minutes and seconds respectively. To create the Timer, we will base ourselves on the Counter example. To adapt the code for the Counter to implement the Timer, we will need to change the mode the view, and the controller Model The previous model was the Counter, we need to replace this class with a new class Timer. The class Timer has The previous model was the Counter; we need to replace this class with a new class Timer. The class Timer has: o Three methods that increments the: hours, minutes and seconds respectively o Three methods that decrements the: hours, minutes and seconds respectively o Three methods that returns the: hours, minutes and seconds respectively o We also need to respect the 24 hours cycle: o The hours are between O and 23 The minutes are between O and 59 o The seconds are between O and 59 View You will need to modify the class GraphicalView so that it creates 6 buttons (to increment/decrements hours, minutes, and seconds) as well as a label (JLabel) that indicates the time. We will use a 2 (rows) by 3 (columns) grid to accommodate all these elements. Controller n the Controller, you will need to modify the method "public void actionPerformed (ActionEvent e)" to accommodate the 6 actions launched by the 6 buttons of the GraphicalView and call the corresponding methods from Timer. Here is an example of the result: IncrementMinutes IncrementSeconds imer 19:3:8 DecrementSeconds d.exe- java App Timer 8:0:0 imer 23:0:0 imer 22:0:0 imer 21:0:0 imer 20:0:0 imer 19:0:8 imer 18:0:0 imer 17:0:0 Timer 18:8:8 imer 19:0:0 imer 18:59:0 imer 18:58:0 imer 18:59:0 Timer 19:0:0 imer 19:1:0 imer 19:2:0 imer 19:3:8 imer 19:2:59 imer 19:3:0 import java.awt.event.*; public class Controller implements ActionListener private Timer model; private View] views; private int numberOfViews; public Controller) views- new View[2]; numberofViews 6 model = new Timer() ; register (new GraphicalView(model, this)); register(new TextView(model)) update) public Timer getModel) return model; public view[] getviews ) f return views private void register(View view) t views[numberOfViews] - view; numberOfviews++; private void update) f for (int i e; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

Draw a labelled diagram of the Dicot stem.

Answered: 1 week ago