//http://timestocome.com //Linda MacPhee-Cobb //Mandelbrot is a fractal //The equation for the Mandlebrot is Z <- Z^2 + C //Z is the complex number x +yi where x and y are usually set to zero to start //C is the points in the plant you are mapping x + yi // //Clicking your mouse in the window re-centers the view on your click //Hit the + key to double the size //Hit the - key to half the size import java.awt.*; import java.awt.event.*; import java.util.*; public class Mandelbrot extends Frame implements Runnable, WindowListener, MouseListener, KeyListener { // Globals int MAX = 500; //size of window in pixels double lowX, highX, lowY, highY; //range for Mandelbrot double x0, y0; //center of Mandelbrot function int max_iterations = 1000; int iteration_array[] = new int[max_iterations]; // how many iterations for each number do we go through loop? public static void main ( String[] args ) { new Mandelbrot(); } //set up window and initial values public Mandelbrot() { //window set up super ( " Window Display " ); setBounds ( 0, 0, MAX, MAX ); setVisible ( true ); addWindowListener ( this ); addMouseListener ( this ); addKeyListener ( this ); //set up initial values lowX = -2.5; lowY = -2.5; highX = 2.5; highY = 2.5; x0 = 0.0; y0 = 0.0; for ( int i=0; i