1 package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui;
2
3 import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.MandelbrotZoomModel;
4
5 import javax.swing.*;
6 import java.awt.*;
7 import java.awt.event.ActionEvent;
8 import java.awt.event.ActionListener;
9
10 import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.RradioButtons.RADIO_BUTTONS_SWITCH;
11 import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.RradioButtons.RADIO_BUTTONS_ZOOM;
12
13
14
15
16
17
18
19
20
21
22
23 public class PanelButtons extends JPanel implements ActionListener {
24
25
26
27 private volatile JButton zoomOut;
28
29 private volatile MandelbrotZoomModel model;
30
31 public PanelButtons(MandelbrotZoomModel model) {
32 this.model = model;
33 JLabel buttonsLabel = new JLabel(model.getProperties().getMandelbrot().getView().getButtonsLabel());
34
35
36
37
38
39
40
41
42
43
44
45
46 this.zoomOut = new JButton(model.getProperties().getMandelbrot().getView().getButtonsZoomOut());
47 this.zoomOut.addActionListener(this);
48 FlowLayout layout = new FlowLayout();
49 this.setLayout(layout);
50 this.add(buttonsLabel);
51
52
53 this.add(zoomOut);
54 }
55
56
57
58
59 @Override
60 public void actionPerformed(ActionEvent ae) {
61
62
63
64
65
66
67 if(ae.getSource() == this.zoomOut){
68 this.model.zoomOut();
69 this.model.getFrame().getCanvas().repaint();
70 }
71 }
72 }