public void mousePressed(MouseEvent e){
	requestFocus();
	int x = e.getX()-margin/2;
	int y = e.getY()-margin/2;
	currentnote = 0;
	if(y < blackH){
	    for(int i = 0; i < nblackkeys; i++){
		if((blackkeystartx[i] < x)&&(blackkeyendx[i] >= x)){
		    currentnote = blackkeynotes[i];
		    break;
		}
	    }
	}
	if(currentnote == 0){
	    for(int i = 0; i < nwhitekeys; i++){
		if((whitekeystartx[i] < x)&&(whitekeyendx[i] >= x)){
		    currentnote = whitekeynotes[i];
		}
	    }
	}
	if(sustain){
	    toggleNote(currentnote);
	}
	else{
	    playNote(currentnote);
	}
    }