package ge.edu.freeuni.sdp.snake;

import ge.edu.freeuni.sdp.snake.model.Configuration;
import ge.edu.freeuni.sdp.snake.model.Level;
import ge.edu.freeuni.sdp.snake.model.SingleMousePopulator;
import ge.edu.freeuni.sdp.snake.model.Size;
import ge.edu.freeuni.sdp.snake.model.SphericTopology;
import ge.edu.freeuni.sdp.snake.presenter.PresenterFactory;
import ge.edu.freeuni.sdp.snake.view.ViewController;
import ge.edu.freeuni.sdp.snake.view.ViewFactory;
import ge.edu.freeuni.sdp.snake.view.swing.SwingViewFactory;

import java.awt.GridLayout;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;

import com.googlecode.lanterna.TerminalFacade;
import com.googlecode.lanterna.terminal.Terminal;
import com.googlecode.lanterna.terminal.TerminalSize;

public class App {

	public static void main(String[] args) {

		Terminal terminal = getTerminal();
		Size size = getSize(terminal);

		List<Level> levels = new ArrayList<Level>();

		Level level1 = new Level("Very Simple Level", new SphericTopology(),
				new SingleMousePopulator());

		// TODO Add other levels here
		levels.add(level1);

		Configuration.init(size, levels);

		// ViewFactory viewFactory = new TerminalViewFactory(terminal);
		ViewFactory viewFactory = new SwingViewFactory(createFrame());
		ViewController controller = new ViewController(viewFactory,
				new PresenterFactory());
		controller.run();

		System.out.println("Hello");

		terminal.exitPrivateMode();

		// createFrame();
	}

	private static JFrame createFrame() {
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setResizable(false);
		frame.setTitle("Snake");
		frame.setLayout(new GridLayout(10, 10, 0, 0));

		// Screen screen = new Screen();
		// frame.add(screen);

		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		return frame;

	}

	private static Terminal getTerminal() {
		Terminal terminal = TerminalFacade.createTerminal(System.in,
				System.out, Charset.forName("UTF8"));
		terminal.enterPrivateMode();
		terminal.clearScreen();
		terminal.setCursorVisible(false);
		return terminal;
	}

	private static Size getSize(Terminal terminal) {
		TerminalSize terminalSize = terminal.getTerminalSize();
		int width = terminalSize.getColumns();
		int height = terminalSize.getRows();

		Size size = new Size(width, height);
		return size;
	}
}
@@ -510,16 +510,43 @@
 ctory;%0A%0A
+import java.awt.Dimension;%0A
 import j
@@ -676,16 +676,43 @@
 .JFrame;
+%0Aimport javax.swing.JPanel;
 %0A%0Aimport
@@ -922,16 +922,19 @@
 s) %7B%0A%0A%09%09
+// 
 Terminal
@@ -962,16 +962,19 @@
 al();%0A%09%09
+// 
 Size siz
@@ -996,16 +996,48 @@
 minal);%0A
+%09%09Size size = new Size(100, 50);
 %0A%09%09List%3C
@@ -1551,16 +1551,19 @@
 o%22);%0A%0A%09%09
+// 
 terminal
@@ -1750,28 +1750,27 @@
 etResizable(
-fals
+tru
 e);%0A%09%09frame.
@@ -1826,13 +1826,11 @@
 ut(1
-0
 , 1
-0
 , 0,
@@ -1894,16 +1894,150 @@
 screen);
+%0A%09%09JPanel screen = new JPanel();%0A%09%09screen.setFocusable(true);%0A%09%09screen.setPreferredSize(new Dimension(800, 400));%0A%09%09frame.add(screen);
 %0A%0A%09%09fram
@@ -2126,24 +2126,53 @@
 frame;%0A%0A%09%7D%0A%0A
+%09@SuppressWarnings(%22unused%22)%0A
 %09private sta
@@ -2417,24 +2417,53 @@
 rminal;%0A%09%7D%0A%0A
+%09@SuppressWarnings(%22unused%22)%0A
 %09private sta

Update App.java