package presentation;

import java.awt.BorderLayout;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import utils.Position;

public class MinesWeeperFrame extends JFrame {

	private JPanel contentPane;
	private GameView gameView;

	public MinesWeeperFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//setBounds(300, 20, 450, 300);
		setBounds(300, 20, 600, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
	}

	public void init () {
		contentPane = new LoginView(false);
		setContentPane(contentPane);
		setSize(270, 139);
		showView("MinesWeeper");
	}
	
	public void showView (String title) {
		setTitle(title);
		setVisible(true);
		setResizable(false);
	}
	
	public void showLevels(String[] levels) {
		switchPanel( new LevelView(levels) );
		setSize(380, 290);
	}
	
	public void showWrongPwd() {
		switchPanel( new LoginView(true) );
		setSize(270, 160);
	}
	
	public void showGame() {
		gameView = new GameView();
		switchPanel( gameView );
		setSize(630, 670);
	}
	
	public void discoverBox(List<Position> toDiscover) {
		gameView.discoverBox(toDiscover);
	}
	
	private void switchPanel(JPanel panel) {
		remove(contentPane);
		contentPane = panel;
		setContentPane(contentPane);
		validate();
		repaint();
	}
}

@@ -20,38 +20,8 @@
 n;%0A%0A
-import java.awt.BorderLayout;%0A
 impo
@@ -39,16 +39,16 @@
 l.List;%0A
+
 %0Aimport 
@@ -97,47 +97,8 @@
 nel;
-%0Aimport javax.swing.border.EmptyBorder;
 %0A%0Aim
@@ -310,10 +310,8 @@
 ;%0A%09%09
-//
 setB
@@ -325,216 +325,20 @@
 00, 
-20, 450, 300);%0A%09%09setBounds(300, 20, 600, 600);%0A%09%09contentPane = new JPanel();%0A%09%09contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));%0A%09%09contentPane.setLayout(new BorderLayout(0, 0));%0A%09%09setContentPane(contentPane
+50, 600, 600
 );%0A%09
@@ -892,17 +892,17 @@
 e(630, 6
-7
+3
 0);%0A%09%7D%0A%09

Clean up