View Javadoc
1   package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
2   
3   import lombok.Getter;
4   import org.woehlke.computer.kurzweil.commons.widgets.SubTabImpl;
5   import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.Mandelbrot;
6   import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.MandelbrotContext;
7   
8   import javax.swing.*;
9   import java.awt.*;
10  
11  @Getter
12  public class PanelZoom extends SubTabImpl implements Mandelbrot {
13  
14      private final MandelbrotContext tabCtx;
15  
16      private final JLabel zoomLevelFieldLabel;
17      private final TextField zoomLevelField;
18      private final JButton zoomOutButton;
19  
20      public PanelZoom(MandelbrotContext tabCtx) {
21          super(
22              tabCtx.getCtx().getProperties().getMandelbrot().getView().getButtonsZoomLabel(),
23              tabCtx.getCtx().getProperties()
24          );
25          this.tabCtx = tabCtx;
26          String buttonsZoomOut = this.tabCtx.getCtx().getProperties().getMandelbrot().getView().getButtonsZoomOut();
27          this.zoomLevelFieldLabel = new JLabel(super.getTitle());
28          this.zoomLevelField = new TextField("1",3);
29          this.zoomOutButton = new JButton(buttonsZoomOut);
30          this.add(this.zoomLevelFieldLabel);
31          this.add(this.zoomLevelField);
32          this.add(this.zoomOutButton);
33          this.zoomOutButton.addActionListener(tabCtx.getTab());
34      }
35  
36  }