Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
Question
Book Icon
Chapter 1, Problem 4E
Program Plan Intro

Question reference: Refer to Chapter 1, Exercise 1.4 to invoke the changeColor() method of the circular object and enter the string “red� as the parameter, and then try other colors as well.

Blurred answer
Students have asked these similar questions
Write down four more color constants that are available in the Color class. Refer to the class’s documentation to find out what they are.
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…
Invoke the changeColor method, and write the color into the parameter field without the quotes. What happens?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT