Create your own green color for the leaves and display a


Program: Interactive Image

Mouse and Keyboard Events

1 Goals.

1. To build an application that uses mouse and keyboard events. Do not use buttons at all.

2. To build a simple picture using the FX graphics facility.

3. This is in place of a programming component for the final exam. You MUST to do this program!

2 Building a Garden

The goal is to make a picture of a simple garden by using the keyboard and mouse. Use the EggCarton and Egg3 Demo programs as examples. Make your application accept inputs and take actions in the following order:

1. Create a stage that is wider than it is tall. Make it big enough for a garden with flowers, a tree and a shrub to be displayed. About half or more of your screen is best.

2. You need only one Scene and one or two Pane(s). You do not need to switch your panes, but you do need to change what is being displayed as you build the garden.

3. Display (somewhere in the scene) a list of at LEAST 3 possible background colors, and the letters to type to select one of them. Create two of these colors yourself and use one color from the FX Color class. Use a keyboard event for this. For example:

Please choose a color:

Y = Yellow
T = Teal
...

4. Wait for the user to type one of the color codes. Then change the background of the pane to that color.

5. Then remove the color menu and replace it by the first prompt, below.

6. Prompt the user to click and drag the mouse to show the location of the tree.

a. Create your own green color for the leaves and display a solid green ellipse filled with your green color whose center is at the beginning of the drag and put a brown rectangle below it as the trunk of the tree.

b. Choose the height of the entire tree to be half the screen height.

c. Make the widest point of the tree to be about 20% of the screen width.

7. Use another drag to show the location of the shrub or put it at the end of the tree's drag.

a. Make the shrub wider than it is tall and no more than ¼ the height of the tree.

b. Create a different green color for the shrub.

8. Prompt the user to click at any location to place a flower there. At a minimum, your flower can be a circle of radius between 12 and 15. It should be filled with a light color, it is best if you can make random light colors for the flowers. If you add leaves to the flower and a center, that is nice. Any number of flowers should be able to be added to the image, one flower for each click.

9. Listen for the up and down arrows to be pressed.

a. If the up arrow is pressed, move all of the flowers up by 5 pixels.

b. If the down arrow is pressed, move all of the flowers down by 5 pixels.

c. You do not have to loop the flowers to the top/bottom if they go off screen, but if you do, that is a nice touch.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create your own green color for the leaves and display a
Reference No:- TGS01406098

Expected delivery within 24 Hours