Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need this in java please. thank you. Objective: In this assignment you'll be drawing all the possible red, green, blue, purple and white shades next

need this in java please. thank you.
image text in transcribed
image text in transcribed
image text in transcribed
Objective: In this assignment you'll be drawing all the possible red, green, blue, purple and white shades next to each other in a window. When you are done, your output should look like this: Color Choices Java Initial Steps: 1) Create a Group object. 2) Create a Canvas of size 300x300 3) Create a GraphicsContext, set it to your canvas getGraphicsContext2D0; 4) Add your canvas to your group Both Languages: 1) Remember an RGB (red, green, blue) value for a color is made up of 3 numbers each between 0 and 255. So solid red is 255,0,0 as you want ALL the red, none of the green and none of the Blue. Solid blue is 0,0,255, and solid purple is made up of red and blue, so it'd be 255,0,255. 2) You'll want to be able to alter your pen using RGB (red, green, blue) values in between drawing each line. a) Java: gc.setStroke(Color.rgb(255,0,0)); //Assumes you called your graphics context go, will set the pen to red b) C#: Color myColor-Color FromArgb(255,0,0); myPen = new Pen(myColor); //Assumes you called your pen myPen, makes pen red. 3) For the red stripe you are going to use a loop from 0 -> 255. a) Set up your pen with the color 0,0,0. b) Draw a line from x=10, y=0 to x=50, y=0 c) Repeat steps a and b, but this time the color should be 1,0,0, and the y values should be 1. Leave the x values the same each time. d) Repeat steps a and b, but this time the color should be 2,0,0 and the y values should be 2. e) 1) Repeat steps a and b all the way until y=255 and color is 255,0,0. 4) Repeat for the green stripe. a) Set up your pen with 0,0,0 b) Draw a line from x=60, y Oto x=100, y 0. c) Repeat steps a and b, but this time the color should be 0,1,0 and the y should be 1. d) e) Repeat steps a and b, but this time the color should be 0,255,0 and the y should be 255. 5) Repeat for the blue stripe. a) These steps are the same, except i) Colors go from 0,0,0 to 0,0,255 ii) Lines are from x=110, y=0 to x=150, y=0 through x=110, y=255 to 150,- 255. 6) Repeat for the purple stripe. a) These steps are the same, except: i) Colors go from 0,0,0 to 255,0,255 (ie, both red and blue increment together) ii) Lines are from x=160, y=0 to x=200, y=0 through x=160,y=255 to x=200, y=255. 7) Repeat for the white strip. a) These steps are the same, except: i) Colors go from 0,0,0 to 255,255,255 i.e. all 3 colors increment together) ii) Lines are from x=210, y=0 to x=250, y=0 through x=210, y=255 to x=250, y=255. Final steps: C#: You are done. Java: Make a new Scene: Scene myScene=new Scene(root); Set the primaryStage.setScene(myScene); //This assumes you called your group root

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

=+what kinds of policies and practices should be developed?

Answered: 1 week ago

Question

=+ Of the HR issues mentioned in the case,

Answered: 1 week ago