public void paintComponent(Graphics g)
	{
		// Create an offscreen BufferedImage to simplify drawing the level view.
		BufferedImage img = new BufferedImage(VIEW_W, VIEW_H,
				BufferedImage.TYPE_INT_ARGB);
		Graphics2D g2D = img.createGraphics();
		g2D.drawImage(background, 0, 0, null);
		if (currentSolution != null && !solver.isSolving() && solver.isPossible()) {
				currentSolution.draw(g2D, viewX, viewY);

				// Draw a selection box around the selected tile.
				int offsetX = -(viewX % Tile.TILE_WIDTH);
				int offsetY = -(viewY % Tile.TILE_WIDTH);
				g2D.drawImage(selectorBox,
						(selectCol * Tile.TILE_WIDTH - viewX - offsetX)
								/ Tile.TILE_WIDTH * Tile.TILE_WIDTH + offsetX,
						(selectRow * Tile.TILE_WIDTH - viewY - offsetY)
								/ Tile.TILE_WIDTH * Tile.TILE_WIDTH + offsetY,
						Tile.TILE_WIDTH, Tile.TILE_WIDTH, null);
		}
		if (solver.isSolving()) {
			g2D.drawImage(generateSolution, 0, 0, null);
		} else if (!solver.isPossible()) {
			g2D.drawImage(noSolution, 0, 0, null);
		}
		g.drawImage(img, VIEW_X, VIEW_Y, null);

		// draw the image to the screen and add the border.
		if (borderFrame != null)
			((Graphics2D) g).drawImage(borderFrame, 0, 0, null);

		// Draw the side GUI.
		if (currentSolution != null && !solver.isSolving()
				&& solver.isPossible()) {
			g.setColor(Color.WHITE);
			g.drawString(currentSolution.nextMove(), MOVE_X, MOVE_Y);
		}
		((Graphics2D) g).drawImage(stepButton, STEP_X, STEP_Y, null);
		((Graphics2D) g).drawImage(exitButton, EXIT_X, EXIT_Y, null);
	}