Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The seven tetrominos: they can be also named by the letter they resemble. The figure shows I (light blue), J (dark blue), O (yellow), L

The seven tetrominos: they can be also named by the letter they resemble. The figure shows I (light blue), J (dark blue), O (yellow), L (orange), T (purple), S (green), Z (red). Your Java program should randomly choose a tetromino shape, a random color for this shape, and a random location within the frame, and displays it on the screen. Then, the program can terminate after a while or wait until the user closes the window.

Create a TetrisViewer class Create a TetrisComponent (should include a method paintComponent and a method setTetromino(/* shape, color */). In the TetrisViewer class, randomly choose a tetromino and its color (use java.util.Random). Set this information in the TetrisComponent. Hint: You will use RGB color system, so you can create three random integers between 0-255 to create a random color. Display the frame and component (in a random location (random x and y coordinate point)). ** You will be displaying one random tetromino only (do not bother to create more objects in one run) ** We are not developing the whole game, so you should not worry about creating multiple different objects and fitting them on the screen... or other specifications of the Tetris game. Our goal is to create one random object only. **Hint: You will use the Rectangle component and locate for square together to create different tetrominos.

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

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

=+b) Is the trend term statistically significant?

Answered: 1 week ago