In JavaFX CSS, you can form a color by specifying certain amounts of red, green, and blue,

Question:

  1. In JavaFX CSS, you can form a color by specifying certain amounts of red, green, and blue, with each color’s amount ranging from 0% to 100%. For example, to specify purple, you could use this code:

    rgb(100%. 60%. 100% )

    The rgb stands for red, green, and blue. With 100% for red and blue, the resulting color is purple. In the following Rgb and RgbDriver class skeletons, replace the insert…> lines with appropriate code such that the program operates properly. More specifically:



    (a) In the Rgb class, provide a method definition for the setRed method such that setRed can be called as part of a method-call chain.



    (b) In the RgbDriver class, provide a single statement that chains calls to the setRed, setGreen, setBlue, and display methods. For your method- call arguments, pass 100 to setRed, 60 to setGreen, and 100 to setBlue. With those argument values, your method-call-chaining statement should print this:

    rgb(100%, 60%, 100%) public class Rgb { private int red; private int green; private int blue; public Rgb

    1. public class RgbDriver { public static void main(String[] args) { Rgb rgb = new Rgb(); } } // end RgbDriver
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: