/* * 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 GUI.Window.Window; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; /** * * @author Kovax */ public class View extends Window { private Controller controller; private Model model; private JFrame frame; public View(Controller game, Model gameModel) { this.model = gameModel; this.controller = game; this.setSize(400,400); this.setLayout(new GridLayout(controller.settings.size,controller.settings.size)); this.draw(); } public void draw() { model.build(); for(int i=0;i<controller.settings.size;i++) { for(JButton actButton : model.squares[i]) { this.add(actButton); } } 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); } }