public MainFrame(String title, Connection conn, Statement state) {
		super(title);

		// Set layout manager
		setLayout(new BorderLayout());

		// Create swing components

		JButton button = new JButton("Go");

		queries = new DBQueries(conn, state);

		DBPanel = new TestPanel(conn, state);

		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("find")) {
					if (DBPanel.getFindGroup().getSelection()
							.getActionCommand().equals("prisoner")) {
						DBPanel.setTextPane(queries.findQuery("Prisoner",
								DBPanel.getTextField().getText(), DBPanel
										.getTextField_2().getText(),
								((ComboItem) DBPanel.getComboBox()
										.getSelectedItem()).getValue()));
					} else if (DBPanel.getFindGroup().getSelection()
							.getActionCommand().equals("security")) {
						DBPanel.setTextPane(queries.findQuery("Security",
								DBPanel.getTextField_5().getText(), DBPanel
										.getTextField_7().getText(),
								((ComboItem) DBPanel.getComboBox_1()
										.getSelectedItem()).getValue()));
					} else {
						// TODO add error message
					}
				} else if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("find prisoners")) {
					DBPanel.setTextPane(queries.joinQuery(DBPanel
							.getTextField_3().getText(), DBPanel
							.getTextField_6().getText(), DBPanel
							.getTextField_1().getText()));

				} else if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("find security")) {
					List<String> checks = new ArrayList<String>();
					if (DBPanel.getChckbxA().isSelected()) {
						checks.add("A");
					}
					if (DBPanel.getChckbxB().isSelected()) {
						checks.add("B");
					}
					if (DBPanel.getChckbxC().isSelected()) {
						checks.add("C");
					}
					if (DBPanel.getChckbxD().isSelected()) {
						checks.add("D");
					}
					if (DBPanel.getChckbxE().isSelected()) {
						checks.add("E");
					}
					DBPanel.setTextPane(queries.divQuery(checks));

				} else if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("current number")) {
					if (DBPanel.getPopCellGroup().getSelection() == null) {
						DBPanel.setTextPane(queries.nestQuery(""));
					} else if (DBPanel.getPopCellGroup().getSelection()
							.getActionCommand().equals("most populated")) {
						DBPanel.setTextPane(queries
								.nestQuery("Most populated cell"));

					} else if (DBPanel.getPopCellGroup().getSelection()
							.getActionCommand().equals("least populated")) {
						DBPanel.setTextPane(queries
								.nestQuery("Least populated cell"));
					}

				} else if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("delete")) {
					if (DBPanel.getDeleteGroup().getSelection()
							.getActionCommand().equals("prisoner")) {
						DBPanel.setTextPane(queries.deleteQuery("Prisoner",
								DBPanel.getTextField_4().getText()));
					} else if (DBPanel.getDeleteGroup().getSelection()
							.getActionCommand().equals("security")) {
						DBPanel.setTextPane(queries.deleteQuery("Security",
								DBPanel.getTextField_8().getText()));
					}

				} else if (DBPanel.getFunctionGroup().getSelection()
						.getActionCommand().equals("update")) {
					DBPanel.setTextPane(queries.updateQuery(DBPanel
							.getTextField_11().getText(), DBPanel
							.getTextField_9().getText(), DBPanel
							.getTextField_10().getText()));
				}
			}
		});

		// Add swing components to content pane
		Container c = getContentPane();

		c.add(new JScrollPane(DBPanel), BorderLayout.CENTER);
		c.add(button, BorderLayout.SOUTH);
		

	};