import java.awt.*; import java.awt.event.*; import java.applet.Applet; import javax.sound.midi.*; public class Akordion1 extends Applet implements MouseListener{ Button cNupp=new Button("C"); Synthesizer synt; MidiChannel kanal; int valjus=100; public Akordion1(){ try{ synt=MidiSystem.getSynthesizer(); synt.open(); kanal=synt.getChannels()[0]; add(cNupp); cNupp.addMouseListener(this); } catch(Exception ex){ex.printStackTrace();} } public void mousePressed(MouseEvent e){ if(e.getSource()==cNupp){ kanal.noteOn(60, valjus); } } public void mouseReleased(MouseEvent e){ kanal.allNotesOff(); } public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String[] arg){ Frame f=new Frame(); f.add(new Akordion1()); f.setSize(300, 300); f.setVisible(true); } }