public ControlsFrame(String title, final MotionScreen attatched) {
		super(title);
		this.attatched = attatched;
		
		ActionListener typeChanged = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {				
				String type = ((JRadioButton)arg0.getSource()).getText();
				if (type.equals("Blocks")){
					attatched.renderBlocks(true);
				} else {
					attatched.renderBlocks(false);
				}
			}
		};
		
		ActionListener editScreen = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
                ((JButton)arg0.getSource()).setEnabled(false);
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        UserInterface layoutGUI = new UserInterface(attatched.getRoot());
                    }
                });
			}
		};
		
		ActionListener up = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.up();
			}
		};
		
		ActionListener down = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.down();
			}
		};
		
		ActionListener left = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.left();
			}
		};
		
		ActionListener right = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.right();
			}
		};
		
		ActionListener incWidth = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.incWidth();
			}
		};
		
		ActionListener incHeight = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.incHeight();
			}
		};
		
		ActionListener decWidth = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.decWidth();
			}
		};
		
		ActionListener decHeight = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				attatched.decHeight();
			}
		};
		
		ActionListener export = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				XMLWriter writer = new XMLWriter();
				try {
					writer.writeFile(attatched.getRoot(), "exported.xml");
				} catch (TransformerConfigurationException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (TransformerException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		};
		
		JPanel top = new JPanel();
		top.setLayout(new BorderLayout());
		getContentPane().add(top);
    	
    	/**
    	 * Add the block type buttons
    	 */
    	for (String lang : BLOCK_TYPES) {
    		JRadioButton btn = new JRadioButton(lang);
    		typeGroup.add(btn);
    		typePanel.add(btn);
    		if (lang.equals("Blocks"))
    			btn.setSelected(true);
    		btn.addActionListener(typeChanged);
    	}
    	
    	typePanel.setBorder(BorderFactory.createTitledBorder("Granularity"));
    	panel.addTab("Display", typePanel);
    	
    	/**
    	 * Add move panel
    	 */
    	JButton btn = new JButton("Left");
    	movePanel.add(btn);
		btn.addActionListener(left);
		
		btn = new JButton("Right");
    	movePanel.add(btn);
		btn.addActionListener(right);
		
		btn = new JButton("Down");
    	movePanel.add(btn);
		btn.addActionListener(down);
		
		btn = new JButton("Up");
    	movePanel.add(btn);
		btn.addActionListener(up);
    	
    	movePanel.setBorder(BorderFactory.createTitledBorder("Move actions"));
    	panel.addTab("Move", movePanel);
    	
    	/**
    	 * Add resize panel
    	 */
    	btn = new JButton("+ Width");
    	resizePanel.add(btn);
		btn.addActionListener(incWidth);
		
		btn = new JButton("- Width");
		resizePanel.add(btn);
		btn.addActionListener(decWidth);
		
		btn = new JButton("+ Height");
		resizePanel.add(btn);
		btn.addActionListener(incHeight);
		
		btn = new JButton("- Height");
		resizePanel.add(btn);
		btn.addActionListener(decHeight);
    	
    	movePanel.setBorder(BorderFactory.createTitledBorder("Resize actions"));
    	panel.addTab("Resize", resizePanel);
    	
    	/**
    	 * Add actions panel
    	 */
    	btn = new JButton("Content edit");
    	buttonsPanel.add(btn);
		btn.addActionListener(editScreen);
		
		btn = new JButton("Export to XML");
		buttonsPanel.add(btn);
		btn.addActionListener(export);
    	
    	buttonsPanel.setBorder(BorderFactory.createTitledBorder("Actions"));
    	panel.addTab("Actions", buttonsPanel);
    	
    	/**
    	 * Add the whole controls screen
    	 */
    	top.add(panel, BorderLayout.CENTER);
    	add(panel);
	}