Write a program that draws the image shown in Figure onto a DrawingPanel of size 650 × 400. The image represents a famous optical illusion called the “Cafe Wall,” in which a series of straight squares appears to be slanted.
Figure

The image has a gray background and many rows of black and white squares with a blue X drawn through each black square. The two free-standing rows in the diagram have the following properties:
Table Cafe Wall Row Properties
Description | (x, y) position | Number of pairs | Size of each box |
upper-left | (0, 0) | 4 | 20 |
mid-left | (50, 70) | 5 | 30 |
The diagram has four grids of rows of squares, with 2 pixels of vertical space between adjacent rows. A key aspect of the optical illusion is that every other row is shifted horizontally by a particular offset. The four grids have the following properties:
Table Cafe Wall Grid Properties
Description | (x, y) position | Number of pairs | Size of each box | 2nd row offset |
lower-left | (10, 150) | 4 | 25 | 0 |
lower-middle | (250, 200) | 3 | 25 | 10 |
lower-right | (425, 180) | 5 | 20 | 10 |
upper-right | (400, 20) | 2 | 35 | 35 |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.