Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need in java using java-FX Concept Summary: 1. Graphics Java/C# 2. Colors 3. Drawing Lines Objective: In this assignment you'll be drawing all the possible

need in java using java-FX

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Concept Summary: 1. Graphics Java/C# 2. Colors 3. Drawing Lines 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 gc, 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) ... f) 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=0 to 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 1) 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 x=150, y=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: 1) 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. Rubric: Red stripe (20 points total) Loop correctly draws 255 lines (10 points) Each line is incrementally more red (10 points) Green stripe (20 points total) Loop correctly draws 255 lines (10 points) Each line is incrementally more green (10 points) Blue stripe (20 points total) Loop correctly draws 255 lines (10 points) Each line is incrementally more blue (10 points) Purple stripe (20 points total) Loop correctly draws 255 lines (10 points) Each line is incrementally more purple (10 points) White stripe (20 points total) Loop correctly draws 255 lines (10 points) Each line is incrementally more white (10 points)

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

Students also viewed these Databases questions

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago