public void createWindow() {
this.hashMap = new HashMap<Long, List<DataPoint>>();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Button buttonStart = new Button("Start");
Button buttonStop = new Button("Stop");
Button buttonMatch = new Button("Match");
Button buttonStartMatch = new Button("Start Match");
Button buttonStopMatch = new Button("Stop Match");
fileTextField = new JTextField(20);
fileTextField.setText("/home/wiktor/audio/billy.mp3");
buttonStart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
try {
listenSound(nrSong, false);
} catch (IOException e1) {
e1.printStackTrace();
} catch (UnsupportedAudioFileException e1) {
e1.printStackTrace();
}
nrSong++;
} catch (LineUnavailableException ex) {
ex.printStackTrace();
}
}
});
buttonStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
running = false;
}
});
buttonStartMatch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
try {
listenSound(nrSong, true);
} catch (IOException e1) {
e1.printStackTrace();
} catch (UnsupportedAudioFileException e1) {
e1.printStackTrace();
}
} catch (LineUnavailableException ex) {
ex.printStackTrace();
}
}
});
buttonStopMatch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
running = false;
}
});