aboutsummaryrefslogtreecommitdiff
path: root/Week11 Mandelbrot/src/fractals/MainWindow.java
blob: 7e72b30e811f024c7cc19612165855f9aa34a129 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package fractals;



import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Insets;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * 
 * @author Sjaak Smetsers
 * @version 1.0, 14-03-2013
 */

/**
 * creates a window to which a GridView panel is added
 * 
 */
public class MainWindow  {
    // the size of the window
    public static final int WIDTH = 500, HEIGHT = 500;
    
    // The grip panel
    private GridView grid;
    
    public MainWindow () {
    	JFrame mainFrame = new JFrame ("Mandelbrot");
        
        mainFrame.setLayout(new BorderLayout());
    	mainFrame.setSize (WIDTH, HEIGHT);
    	mainFrame.setLocationRelativeTo(null);
    	mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	mainFrame.setResizable(false);
    	mainFrame.setVisible(true);
    	
        Insets insets = mainFrame.getInsets();
        grid = new GridView(WIDTH - insets.left - insets.right, HEIGHT - insets.top - insets.bottom);
        mainFrame.add(grid, BorderLayout.CENTER);
        
        JPanel panel = new JPanel(new FlowLayout());
        panel.add(new JButton("test"));
        mainFrame.add(panel, BorderLayout.PAGE_END);
        
        mainFrame.pack();
    }
    
    /**
     * A getter for the grid
     * @return the grid
     */
    public Grid getGrid () {
    	return grid;
    }
    
}