public TuringMachineFrame(String title, boolean status, TuringMachine model, TuringMachineMenuPanel view0, TuringMachineLoadPanel view1, TuringMachineStartPanel view2, TuringMachineTransitionPanel view3, TuringMachineInputPanel view4, TuringMachineSimulationPanel view5){
		super(title);
		
		isChild = status;
		aTuringMachine = model;
		cards = new CardLayout();
		mainPanel = new JPanel();
		mainPanel.setLayout(cards);
		menuView = view0;
		loadView = view1;
		startView = view2;
		transitionView = view3;
        inputView = view4;
        simulationView = view5;
        mainWindow = this;
        
        mainPanel.add(menuView,"0");
        mainPanel.add(loadView,"1");
        mainPanel.add(startView,"2");
        mainPanel.add(transitionView,"3");
        mainPanel.add(inputView,"4");
        mainPanel.add(simulationView,"5");
		add(mainPanel);		
		cards.show(mainPanel,"0");
		
		// add listeners in menuView
		menuView.getLoadButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleLoadButton();
			}
		});
		
		menuView.getLoadButton().addMouseListener(new MouseAdapter() {
			public void mouseEntered(MouseEvent e) {
				menuView.setCurrentButton(1);
			}
		});
		
		menuView.getCreateButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleCreateButton();
			}
		});
		
		menuView.getCreateButton().addMouseListener(new MouseAdapter() {
			public void mouseEntered(MouseEvent e) {
				menuView.setCurrentButton(2);
			}
		});
		
		// add listeners in loadView
		loadView.getLoadMachineButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleLoadMachineButton();
			}
		});
		
		loadView.getRemoveMachineButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleRemoveMachineButton();
			}
		});
		
		loadView.getLoadBackButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleLoadBackButton();
			}
		});
				
		// add listeners in startView
		startView.getAddTapeAlphabetButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleAddTapeAlphabetButton();
			}
		});
                
        startView.getAddInputAlphabetButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleAddInputAlphabetButton();
			}
		});
		
		startView.getAddStateButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleAddStateButton();
			}
		});
		
		startView.getRemoveTapeAlphabetButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleRemoveTapeAlphabetButton();
			}
		});
                
        startView.getRemoveInputAlphabetButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleRemoveInputAlphabetButton();
			}
		});
		
		startView.getRemoveStateButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleRemoveStateButton();
			}
		});
		
		startView.getNextButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleNextButton();
			}
		});
		
		startView.getStartBackButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleStartBackButton();
			}
		});
		
		// add listeners in transitionView		
		transitionView.getBackButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleBackButton();
			}
		});
                
        transitionView.getSaveButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleSaveButton();
			}
		});
        
        transitionView.getNextButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleSecondNextButton();
			}
		});
                
        transitionView.getTransitionList().addListSelectionListener(new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				handleSelectedListItem();
			}
		});
                
        transitionView.getStateComboBox().addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
            	handleComboBoxSelection();
        	}
        });
                
        // add listeners in inputView
		inputView.getAddButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleAddInputButton();
			}
		});
                
        inputView.getRemoveButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleDeleteInputButton();
			}
		});
		
		inputView.getClearButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleClearInputButton();
			}
		});
                
        inputView.getBackButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleSecondBackButton();
			}
		});
                
        inputView.getBuildButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleBuildButton();
			}
		});
        
        // add listeners in simulationView
        simulationView.getRunButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleRunButton();
			}
		});
                
        simulationView.getSaveMachineButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleSaveMachineButton();
			}
		});
                
        simulationView.getChangeInputButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleChangeInputButton();
			}
		});
                
        simulationView.getResetButton().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handleResetButton();
			}
		});
                
        simulationView.getSlider().addChangeListener(new ChangeListener(){
        	public void stateChanged(ChangeEvent e){
            	handleSlider((JSlider)e.getSource());
        	}
        });
                
        simulationView.getSpinner().addChangeListener(new ChangeListener(){
         	public void stateChanged(ChangeEvent e){
             	handleSpinner((JSpinner)e.getSource());
       	     }
        });
                
        // add timer listeners
        aTimer = new Timer(1000 ,new ActionListener(){
        	public void actionPerformed(ActionEvent e){
            	handleTimerTick();
        	}
        });               
		
		// add menu bar
		menuBar = new JMenuBar();
		fileMenu = new JMenu("File");
		fileMenu.setMnemonic(KeyEvent.VK_F);

		mainItem = new JMenuItem("Main Menu", KeyEvent.VK_M);
		mainItem.setEnabled(false);
		fileMenu.add(mainItem);
			
		exitItem =new JMenuItem("Exit", KeyEvent.VK_X);
		fileMenu.add(exitItem);		
		
		menuBar.add(fileMenu);
		
		helpMenu = new JMenu("Help");
		helpMenu.setMnemonic(KeyEvent.VK_H);
		
		aboutItem = new JMenuItem("About", KeyEvent.VK_A);
		helpMenu.add(aboutItem);
		
		menuBar.add(helpMenu);
		
		setJMenuBar(menuBar);
		
		// add menu item listeners
		mainItem.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {				
				handleSecondBackButton();
				handleBackButton();
				handleStartBackButton();	        
		    }
		});
			
		exitItem.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){     
				int result = JOptionPane.showConfirmDialog(mainWindow,"Are you sure you want to exit?","Exit",JOptionPane.YES_NO_OPTION);			 
			    if (result == JOptionPane.YES_OPTION) System.exit(0);					   
		    }
		});
		
		aboutItem.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				if(Desktop.isDesktopSupported()){
					try {
		            	Desktop.getDesktop().browse(new URL("https://github.com/Enixma/Turing-Machine-Simulation").toURI());
		        	}catch (Exception ex) {		        
				    }
				}
			}
		});
		
		// set frame properties
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
 		addWindowListener( new WindowAdapter(){
			public void windowClosing(WindowEvent e){     
		        if(isChild){	 
		        	JFrame frame = (JFrame)e.getSource();
			        int result = JOptionPane.showConfirmDialog(frame,"Are you sure you want to close this window?","Close Window",JOptionPane.YES_NO_OPTION);
			        if (result == JOptionPane.YES_OPTION) setDefaultCloseOperation(DISPOSE_ON_CLOSE);
				}
				else{
					int result = JOptionPane.showConfirmDialog(mainWindow,"Are you sure you want to exit?","Exit",JOptionPane.YES_NO_OPTION);			 
			        if (result == JOptionPane.YES_OPTION) setDefaultCloseOperation(EXIT_ON_CLOSE);					
				}    
		    }
		});		
		
		setSize(1000,720);
		setResizable(false);
		setChildProperties();				
    }