Newer
Older
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package GUI.game;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author Kovax
*/
public class View extends Window
{
private Controller controller;
private Model model;
private JButton[][] squares;
private JFrame frame;
public View()
{
this.setSize(400,400);
this.setLayout(new GridLayout(6,6));
squares = new JButton[6][6];
}
View(Controller game, Model gameModel)
{
this.model = gameModel;
this.controller = game;
}
public void draw()
{
this.build();
if( this.frame != null )
{
frame.dispose();
}
this.frame = new JFrame("Aknakereső");
frame.add(this);
frame.setSize(400,400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public void build()
{
for(int i=0;i<6;i++)
{
for(int j=0;j<6;j++)
{
squares[i][j] = new JButton();
squares[i][j].setSize(400,400);
this.add(squares[i][j]);
}
}
}
}