Shooting star

Assignment Help JAVA Programming
Reference no: EM13552202

Shooting Star

A Block and DoubleListOfBlock classes. You need to implement that DoubleListOfBlock methods so they perform according to the specifications (pre and post conditions). You can choose to use sentinels and pre-pointers or not, but the given methods are all that should be in the DoubleListOfBlock class. The Block class inherits JComponent to create objects that (when added) produce filled 10 by 10 squares whose color can be assigned by setBackground.

Your Driver class must implement a black JFrame and two JButton objects - one called Grow and Shrink. Note that by implementing ActionListener and calling addActionListener, your Driver can create and handle events for its own JButtons. Driver must also manipulate four DoubleListOfBlock objects -- a horizontal list, a vertical list, a major diagonal list and a minor diagonal list. All three lists are spread, centered, across the JFrame as their names imply and pictured below:

1069_Star.png

Initially, all that is visible of the four lists are four randomly-colored blocks in the center of the JFrame. Each click of the Grow button causes all four lists to grow by two Blocks from its center, thereby "pushing" the prior blocks outward by 10 pixels. All four lists must insert the same randomly-selected color as their new center Blocks.

Each click of the Shrink button causes all four lists to shrink by removing their centermost two Blocks. Both Grow and Shrink operations update the JFrame to be consistent. (You can observe this behavior in the sample applet on Riley's website.)

Selecting a random color is best accomplished by creating a java.awt.Color object and passing the Color constructor three random int parameters in the range from 0 through 255. (Math.random() returns a double in the range from 0.0 up to but not equal to 1.0.)

Using the java.awt.event.MouseListener interface, cause your Block objects to handle events in the following way. Every time that a Block is clicked, that Block and all other Blocks equidistant from the center of the four lists are all colored white.

Reference no: EM13552202

Questions Cloud

Define the vapor pressure of ccl3f : The vapor pressure of CCl3F at 300 K is 856 torr. If 11.5 g of CCl3F is enclosed in a 1.2 -L container, will any liquid be present. If so, what mass of liquid
How long does it take ironman to catch the fellow : Ironman is chasing a bad guy who is running at 7.2 m/s. When he is 143m behind the bad guy, How long does it take Ironman to catch the fellow
Obtain how high does the rocket travel : a model rocket is fired vertically from rest. It has acceleration of 14.2m/s^2. how high does the rocket travel
The density of a human body can be the density of water : The density of a human body can be approximated by the density of water, which is equal to 1.000 x 103 kg/m3. What volume will a 185 lb person occupy in liters
Shooting star : Initial project folder you will see the beginnings of a Driver - You need to implement that DoubleListOfBlock methods so they perform
What is the speed of the ball at the highest point : a ball is thrown from a point 1.0m above the ground. the initial velocity is 6.8m/s at an angle of 30 degrees above the horizontal. What is the speed of the ball at the highest point
Through what distance does the point move in one revolution : A rotating fan completes 1200 revolutions every minute. Consider a point on the tip of a blade, at a radius of .20 m.
What is the minimum number of photons : The ultraviolet excimer laser used in the PRK technique (see Section 30.9) has a wavelength of 193 nm. What is the minimum number of photons
How long does the ball take to reach the wall : You throw a ball torwards a wall at speed 21 m/s and an angle of 40 degrees above the horizontal. The wall is 22.0 m from the release point of the ball.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a while loop that lets the user enter a number

1) Write a while loop that lets the user enter a number. The number should then be multiplied by 10, and stored in a variable called product. The loop should then iterate as long as product contains a value less than 100.

  Java program that implements an algorithm known as a bubble

writing a simple Java program that implements an algorithm known as a Bubble Sort. A Bubble Sort is a simple sorting algorithm that takes an unsorted array of elements and sorts them into ascending order.

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  What is the paintcomponent method how is it used in java

q1. what is the paintcomponent method? how is it used in java graphics? how does a program intentionally cause the

  The class overloaded constructor receives a 2-dim int array

The class overloaded constructor receives a 2-dim int array as a parameter and assigns its values to a private 2-dim int array. Have another method that prints the whole 2-dim table.

  Write a generic class

Write a generic class (using Java generics) called Pair that stores two values of the generic type.  It should have a constructor to set them, two methods getfirst() and getsecond() to retrieve them.

  The data-centric java agricultural image storing application

Develop and test a specified a data-centric Java application. The required application is described in the Agricultural Image storing application- case-study

  Record managing system application

Build a student record managing system application

  Write a version of sumpairs

Write a version of sumPairs  that sums each component of the pairs separately, returning a pair consisting of the sum of the first components and the sum of the second components. So basically [(3,1)(10,3)] would return (13,4).

  Write a program to play a variation of the game

Roll two dice. Each die has six faces representing values 1, 1, ..., and 6. Check the sum of the two dice. If the sum is 2, 3, or 12 you lose; if the sum is 7 or 11, you win. If the sum is another value (4,5,6,8,9, or 10) a point is established.

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Length of the string in order to reserve space

To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd