View Javadoc
1   package org.woehlke.computer.kurzweil.tabs.cca;
2   
3   import lombok.Getter;
4   import lombok.experimental.Delegate;
5   import lombok.extern.log4j.Log4j2;
6   import org.woehlke.computer.kurzweil.commons.Startable;
7   import org.woehlke.computer.kurzweil.commons.Updateable;
8   import org.woehlke.computer.kurzweil.commons.widgets.PanelStartStopButtons;
9   import org.woehlke.computer.kurzweil.commons.widgets.SubTabImpl;
10  import org.woehlke.computer.kurzweil.tabs.cca.canvas.PanelNeighbourhoodButtons;
11  
12  import javax.swing.*;
13  
14  @Log4j2
15  @Getter
16  public class CyclicCellularAutomatonTabPane extends JTabbedPane implements Startable {
17  
18      @Delegate(excludes={SubTabImpl.class,JPanel.class,Updateable.class})
19      private final PanelNeighbourhoodButtons panelNeighbourhoodButtons;
20      @Delegate(excludes={SubTabImpl.class,JPanel.class,Updateable.class})
21      private final PanelStartStopButtons startStopButtonsPanel;
22  
23      private final CyclicCellularAutomatonTab tab;
24  
25      public CyclicCellularAutomatonTabPane(CyclicCellularAutomatonTab tab) {
26          this.tab = tab;
27          this.panelNeighbourhoodButtons = new PanelNeighbourhoodButtons(tab.getCanvas());
28          this.startStopButtonsPanel = new PanelStartStopButtons( tab );
29          this.addTab(this.startStopButtonsPanel.getTitle(), this.startStopButtonsPanel);
30          this.addTab(this.panelNeighbourhoodButtons.getTitle(), this.panelNeighbourhoodButtons);
31          this.panelNeighbourhoodButtons.getButtonVonNeumann().addActionListener( tab);
32          this.panelNeighbourhoodButtons.getButtonMoore().addActionListener( tab);
33          this.panelNeighbourhoodButtons.getButtonWoehlke().addActionListener(tab);
34          this.startStopButtonsPanel.stop();
35      }
36  
37  }
38  
39