aboutsummaryrefslogtreecommitdiff
path: root/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java
diff options
context:
space:
mode:
Diffstat (limited to 'Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java')
-rw-r--r--Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java43
1 files changed, 25 insertions, 18 deletions
diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java
index 225347a..9322be9 100644
--- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java
+++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java
@@ -23,33 +23,40 @@
*/
package com.camilstaps.mandelbrot;
-import javax.swing.JButton;
-import javax.swing.JTextField;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import javax.swing.JFrame;
/**
* Solutions to week 15
* @author Camil Staps
*/
-public class MandelbrotWindow {
-
- private final DrawView drawView;
-
- private final String INITIAL_CENTER_X = "0",
- INITIAL_CENTER_Y = "0",
- INITIAL_SCALE = "100",
- INITIAL_REPETITIONS = "100";
-
- private final JTextField field_centerX = new JTextField(INITIAL_CENTER_X, 6);
- private final JTextField field_centerY = new JTextField(INITIAL_CENTER_Y, 6);
- private final JTextField field_scale = new JTextField(INITIAL_SCALE, 6);
- private final JTextField field_repetitions = new JTextField(INITIAL_REPETITIONS, 6);
- private final JButton button_redraw = new JButton("Redraw");
+public class MandelbrotWindow extends JFrame {
private MandelbrotWindow() {
+ super("Mandelbrot");
+
FractalModel fm = new FractalModel();
- drawView = new DrawView(fm);
- ZoomFrame frame = new ZoomFrame("Mandelbrot", drawView);
+ setLayout(new BorderLayout());
+
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setLocationRelativeTo(null);
+ setVisible(true);
+
+ Grid grid = new Grid(fm);
+ Textfields textfields = new Textfields(fm);
+
+ add(grid, BorderLayout.CENTER);
+ add(grid.getProgressView(), BorderLayout.SOUTH);
+ add(textfields, BorderLayout.EAST);
+
+ getContentPane().setPreferredSize(new Dimension(
+ grid.getWidth() + textfields.getWidth(),
+ Math.max(grid.getHeight(), textfields.getHeight()) + grid.getProgressView().getHeight()
+ ));
+ pack();
+ setResizable(false);
}
public static void main(String[] args) {