View Javadoc
1   package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
2   
3   import lombok.Getter;
4   import org.woehlke.computer.kurzweil.commons.Updateable;
5   import org.woehlke.computer.kurzweil.commons.widgets.SubTab;
6   import org.woehlke.computer.kurzweil.commons.widgets.SubTabImpl;
7   import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.Mandelbrot;
8   import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.MandelbrotContext;
9   import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.MandelbrotModel;
10  
11  import javax.swing.*;
12  
13  import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.RradioButtons.RADIO_BUTTONS_SWITCH;
14  import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.RradioButtons.RADIO_BUTTONS_ZOOM;
15  
16  @Getter
17  public class PanelChooseMouseClickMode extends SubTabImpl implements Mandelbrot, SubTab, Updateable {
18  
19      private final MandelbrotContext tabCtx;
20      private final String buttonsSwitch;
21      private final String buttonsZoom;
22      private final JRadioButton radioButtonsSwitch;
23      private final JRadioButton radioButtonsZoom;
24      private final ButtonGroup radioButtonsGroup;
25      private final MandelbrotModel mandelbrotModel;
26  
27      public PanelChooseMouseClickMode(MandelbrotContext tabCtx) {
28          super(
29              tabCtx.getCtx().getProperties().getMandelbrot().getView().getButtonsLabel(),
30              tabCtx.getCtx().getProperties()
31          );
32          this.tabCtx = tabCtx;
33          this.mandelbrotModel = tabCtx.getTabModel();
34  
35          this.buttonsSwitch = this.tabCtx.getCtx().getProperties().getMandelbrot().getView().getButtonsSwitch();
36          this.buttonsZoom = this.tabCtx.getCtx().getProperties().getMandelbrot().getView().getButtonsZoom();
37  
38          this.radioButtonsSwitch = new JRadioButton(buttonsSwitch);
39          this.radioButtonsSwitch.setMnemonic(RADIO_BUTTONS_SWITCH.ordinal());
40          this.radioButtonsZoom = new JRadioButton(buttonsZoom);
41          this.radioButtonsZoom.setMnemonic(RADIO_BUTTONS_ZOOM.ordinal());
42          this.radioButtonsSwitch.setSelected( true );
43          this.radioButtonsGroup = new ButtonGroup();
44          this.radioButtonsGroup.add(radioButtonsSwitch);
45          this.radioButtonsGroup.add(radioButtonsZoom);
46          this.add(radioButtonsSwitch);
47          this.add(radioButtonsZoom);
48          this.getRadioButtonsSwitch().addActionListener(this.tabCtx.getTab());
49          this.getRadioButtonsZoom().addActionListener(this.tabCtx.getTab());
50      }
51  
52      @Override
53      public void update() {
54          //TODO:
55      }
56  }