package ge.edu.freeuni.sdp.snake.view.swing;

import ge.edu.freeuni.sdp.snake.presenter.MazePresenter;
import ge.edu.freeuni.sdp.snake.view.MazeView;

import javax.swing.JFrame;

public class SwingMazeView implements MazeView {
	private MazePresenter presenter;
	private JFrame frame;

	public SwingMazeView(MazePresenter presenter, JFrame frame) {
		this.presenter = presenter;
		this.frame = frame;
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub

	}

}

@@ -39,16 +39,72 @@
 swing;%0A%0A
+import ge.edu.freeuni.sdp.snake.presenter.DirectionKey;%0A
 import g
@@ -215,73 +215,233 @@
 java
-x.swing.JFrame;%0A%0Apublic class SwingMazeView implements MazeView %7B
+.awt.event.KeyEvent;%0Aimport java.awt.event.KeyListener;%0A%0Aimport javax.swing.JFrame;%0A%0Apublic class SwingMazeView implements MazeView, KeyListener %7B%0A%09@SuppressWarnings(%22unused%22)%0A%09private JFrame frame;%0A%09private DirectionKey key;
 %0A%09pr
@@ -471,16 +471,17 @@
 senter;%0A
+%0A
 %09private
@@ -481,29 +481,128 @@
 private 
-JFrame frame;
+void sleep() %7B%0A%09%09try %7B%0A%09%09%09Thread.sleep(100);%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D
 %0A%0A%09publi
@@ -658,16 +658,38 @@
 rame) %7B%0A
+%09%09this.frame = frame;%0A
 %09%09this.p
@@ -721,56 +721,727 @@
 his.
-frame = frame;%0A%09%7D%0A%0A%09@Override%0A%09public void show(
+key = DirectionKey.None;%0A%09%7D%0A%0A%09@Override%0A%09public void show() %7B%0A%09%09while (true) %7B%0A%09%09%09if (presenter.isGameOver())%0A%09%09%09%09return;%0A%09%09%09presenter.tick(key);%0A%09%09%09this.sleep();%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public void keyPressed(KeyEvent e) %7B%0A%09%09switch (e.getKeyCode()) %7B%0A%09%09case KeyEvent.VK_UP:%0A%09%09%09this.key = DirectionKey.Up;%0A%09%09%09break;%0A%0A%09%09case KeyEvent.VK_DOWN:%0A%09%09%09this.key = DirectionKey.Down;%0A%09%09%09break;%0A%0A%09%09case KeyEvent.VK_LEFT:%0A%09%09%09this.key = DirectionKey.Left;%0A%09%09%09break;%0A%0A%09%09case KeyEvent.VK_RIGHT:%0A%09%09%09this.key = DirectionKey.Right;%0A%09%09%09break;%0A%0A%09%09default:%0A%09%09%09this.key = DirectionKey.None;%0A%09%09%09break;%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public void keyReleased(KeyEvent e) %7B%0A%09%09// TODO Auto-generated method stub%0A%0A%09%7D%0A%0A%09@Override%0A%09public void keyTyped(KeyEvent e
 ) %7B%0A

Update SwingMazeView.java