Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M91784660

Have any Question?


Related Questions in Java

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As