“Enlarge” and “Shrink”

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Add two new buttons that will be used to enlarge or shrink the circle, placing these buttons below the others. The text on these buttons can be simply “Enlarge” and “Shrink”. The size of a circle object is determined by the radius property, and the Circle class provides two methods to access and change its radius. Assuming c refers to a circle object, c.getRadius() returns the current radius of the circle; c.setRadius(r) changes the radius of the circle to the value r. You will need to add event handlers for the Enlarge and Shrink buttons, which should increase or decrease the radius of the circle by 10 pixels each time that the button is clicked. Remember that the handler for each button must be activated by invoking the setOnAction method, as we did for the other buttons. The code to handle these events will need to be added by creating two new branches inside the handle method of your program. • For the Shrink button, add a condition to the handler, to prevent the circle from becoming invisible, so it will not change the radius if it would shrink to zero or a negative number. • For the Enlarge button, add a condition to the handler, to prevent the circle from becoming larger than the window. The scene is is created with a width of 450 pixels and the buttons may have a width of up to 80 pixels, so do not increase the radius if it would become larger than 185 pixels. It is alright for part of the circle to extend outside the visible window, but don’t let the circle fill the entire window.

Expert Solution
steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY