import java.awt.*; import java.awt.event.*; import java.io.*; import javax.sound.midi.*; public class Midimangija extends Panel implements ActionListener, AdjustmentListener{ Scrollbar level1=new Scrollbar(Scrollbar.VERTICAL, 50, 0, 0, 100); Scrollbar volume1=new Scrollbar(Scrollbar.VERTICAL, 50, 0, 0, 100); Scrollbar repeat1=new Scrollbar(Scrollbar.VERTICAL, 10, 0, 1, 50); Scrollbar tempo1=new Scrollbar(Scrollbar.VERTICAL, 1000, 0, 100, 10000); Label level2=new Label("Sound level: "); Label volume2=new Label("Volume: "); Label repeat2=new Label("Repeat: "); Label tempo2=new Label("Tempo: "); Button mangi=new Button("Mängi ette"); int level; int volume; int repeat; int tempo; public Midimangija(){ Panel p1=new Panel(); p1.add(mangi); Panel p2=new Panel(); p2.add(level2); p2.add(level1); p2.add(volume2); p2.add(volume1); p2.add(repeat2); p2.add(repeat1); p2.add(tempo2); p2.add(tempo1); setLayout(new BorderLayout()); add(p1, BorderLayout.NORTH); add(p2, BorderLayout.SOUTH); mangi.addActionListener(this); level1.addAdjustmentListener(this); volume1.addAdjustmentListener(this); repeat1.addAdjustmentListener(this); tempo1.addAdjustmentListener(this); } public void actionPerformed(ActionEvent e){ try{ Synthesizer synthesizer=MidiSystem.getSynthesizer(); synthesizer.open(); MidiChannel kanal=synthesizer.getChannels()[0]; for(int i=0; i