import javax.swing.*;  
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;

class KeypressControl implements KeyListener{

	private boolean[] buttons = new boolean[20];
	private char[] key = new char[20];

	public KeypressControl(JPanel j){
		j.addKeyListener(this);
		key[0] = 'q';
		key[1] = 'w';
		key[2] = 'e';
		key[3] = 'r';
		key[4] = 't';
		key[5] = 'y';
		key[6] = 'u';
		key[7] = 'i';
		key[8] = 'o';
		key[9] = 'p';
		key[10] = 'a';
		key[11] = 's';
		key[12] = 'd';
		key[13] = 'f';
		key[14] = 'g';
		key[15] = 'h';
		key[16] = 'j';
		key[17] = 'k';
		key[18] = 'l';
		key[19] = 'z';
	}
	
	public void keyPressed(KeyEvent e){
		for (int c = 0; c < 20; c++)
		{
			if (e.getKeyChar() == key[c]) {
				buttons[c] = true;
			}
		}
	}
	public void keyReleased(KeyEvent e){ 
		for (int c = 0; c < 20; c++)
		{
			if (e.getKeyChar() == key[c]) {
				buttons[c] = false;
			}
		}
	}
	
	public void keyTyped(KeyEvent e){
		/*
		for (int c = 0; c < 20; c++)
		{
			if (e.getKeyChar() == key[c]) {
				buttons[c] = true;
			}
		}
		*/ 
		}
	
	public boolean[] getInput() {
		return(buttons);
	}
}
