-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimator.java
50 lines (44 loc) · 1.22 KB
/
Animator.java
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
package FractalAnimator;
/**
* Generates a serie of Fractal pictures and stores it on the hard disc
* You can set a start and end point serie *
*
* @author Michael Muehlebach
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Animator extends JFrame{
private JTextField x, y, w, h, i;
public Animator(int cols, int rows){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(cols*2, rows*2);
setTitle("Fractal-Animator");
Container cp = getContentPane();
JPanel set = new JPanel(new GridLayout(5, 2));
FractalView view = new FractalView(new MandelbrotFractal(254, -2f, 2f, -2f, 2f));
x = new JTextField();
y = new JTextField();
w = new JTextField();
h = new JTextField();
i = new JTextField();
set.add(new JLabel("xm:"));
set.add(x);
set.add(new JLabel("ym:"));
set.add(y);
set.add(new JLabel("w:"));
set.add(w);
set.add(new JLabel("h"));
set.add(h);
set.add(new JLabel("i"));
set.add(i);
view.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
x.setText(new Integer(e.getX()).toString());
y.setText(new Integer(e.getY()).toString());
}
});
cp.add(view, BorderLayout.CENTER);
cp.add(set, BorderLayout.NORTH);
}
}