private void adaptView() {
		currentTime = 0;
		MineSweeperDigitView.setValue(timeView, 0);
		flagsAvail = model.getMines();
		MineSweeperDigitView.setValue(flagsView, flagsAvail);

		width = model.getWidth();
		height = model.getHeight();

		mainPanel.removeAll();
		mainPanel.setLayout(new GridLayout(height, width));
		mainPanel.setSize(width * (buttonSize + 1), height * (buttonSize + 1));
		mainPanel.setPreferredSize(mainPanel.getSize());

		buttons = new MineSweeperCellButton[height][width];

		controller.setListener(new MineSweeperActionListener() {

			public void cellBombed(int i, int j) {
				final ImageIcon img = MineSweeperResources.getIcon("mine.png");
				buttons[i][j].setIcon(img);
				model.applyToWorld(new MineSweeperWorldAction() {
					public void actionPerfromed(int i, int j,
							MineSweeperCell cell) {
						buttons[i][j].setClickable(false);
						if (cell.isMined()) {
							buttons[i][j].setIcon(img);
						}
					}
				});
				face.setIcon(MineSweeperResources.getIcon("face1.png"));
				JOptionPane.showMessageDialog(MineSweeperGUI.this, "Oops. You died. Have a nice day.");
				//\n\nDon't you want to save your score?");
//				if (null != user) {
//					saveScore(user);
//				}
			}

			public void cellOpened(int i, int j) {
				int val = model.getCell(i, j);
				Color c;

				if (model.isFlagged(i, j))
					return;

				buttons[i][j].setClickable(false);
				buttons[i][j].setBackground(Color.WHITE);

				if (0 == val)
					return;

				buttons[i][j].setText("" + val);
				switch (val) {
				case 1:
					c = Color.BLUE;
					break;
				case 2:
					c = Color.GREEN;
					break;
				case 3:
					c = Color.ORANGE;
					break;
				default:
					c = Color.RED;
					break;
				}
				buttons[i][j].setForeground(c);
			}

			public void userWon() {
				for (int i = 0; i < height; ++i) {
					for (int j = 0; j < width; ++j) {
						buttons[i][j].setClickable(false);
					}
				}
				String user = JOptionPane
						.showInputDialog("Congrats! You won.\nEnter your name if you want to save the score:");
				if (null != user) {
					saveScore(user);
				}
			}

			public void timerAction() {
				synchronized (this) {
					currentTime++;
				}
				currentTime %= 100;
				MineSweeperDigitView.setValue(timeView, currentTime);
			}

		});
		setupButtons();
		pack();
	}