import java.applet.Applet; import java.awt.event.*; import java.awt.*; import javax.sound.midi.*; public class Klaver1 extends Applet implements KeyListener{ MidiChannel kanal; public Klaver1(){ try{ Synthesizer st=MidiSystem.getSynthesizer(); st.open(); kanal=st.getChannels()[0]; addKeyListener(this); }catch(Exception viga){ System.out.println("Probleem: "+viga); } } public void keyPressed(KeyEvent e){ kanal.noteOn(60, 70); } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} public static void main(String argumendid[]){ Frame f=new Frame("Klahvikuular"); f.add(new Klaver1()); f.setSize(300, 300); f.setVisible(true); } }