import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.*;

/**
 * Little GUI to shake the Z axis on the
 * oswald interface, even if we are running
 * on a computer, not the oswald.
 * @author goskab
 *
 */
public class OswaldInterfaceTest extends JFrame {
	JButton toggle;
	ArrayList<Integer> list;
	/**
	 * makes a new oswald interface tester
	 * allows you to simulate shaking the
	 * oswald.
	 */
	public OswaldInterfaceTest(ArrayList<Integer> l) {
		this.setLayout(null);
		this.setSize(130, 100);
		
		toggle = new JButton("Shake It");
		this.add(toggle);
		toggle.setSize(100,50);
		toggle.setLocation(10,10);
		toggle.setVisible(true);
		toggle.addActionListener(new Shaker());
		
		this.setVisible(true);
		list = l;
		for (int i = 0; i < 5; i++)
			list.add(0);
	}
	
	public class Shaker implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			if (list.get(4) == 0)
				list.set(4, 20000);
			else
				list.set(4, 0);
		}
	}
}
