Java Genesis

Hints for Chapter 1: Getting Started

Problem 3: hint 2

Consider the following segment of code from the middle of the PushingPanel.java file:

	g.setColor(Color.red);
	if (isRightArrow) g.fillPolygon(rxs, rys,7);
	if (isDownArrow) g.fillPolygon(dxs, dys,7);
	if (isLeftArrow) g.fillPolygon(lxs, lys,7);
	if (isUpArrow) g.fillPolygon(uxs, uys,7);
Without going into details, this is the part of the code responsible for setting the arrow red. Replace the first line above by
	g.setColor(Color.blue);
but leave the rest of the code unaltered. Now recompile this code and rerun the application (by running the class PushingPuzzle). You will find the arrow is now blue!

Previous Hint