ai Sound when clicked
This commit is contained in:
parent
d6c376ab27
commit
31571fcd99
Binary file not shown.
|
|
@ -28,4 +28,16 @@ public class SoundEffect {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void aiSound() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
File file = new File("Voicy_R2-D2-7.wav");
|
||||||
|
AudioInputStream audioStream = AudioSystem.getAudioInputStream(file);
|
||||||
|
Clip clip = AudioSystem.getClip();
|
||||||
|
clip.open(audioStream);
|
||||||
|
clip.start();
|
||||||
|
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
package windowInterface;
|
package windowInterface;
|
||||||
|
import backend.SoundEffect;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
|
|
@ -43,6 +44,7 @@ public class MyInterface extends JFrame {
|
||||||
private JLabel actionLabel;
|
private JLabel actionLabel;
|
||||||
private JCheckBox chckbxBlackAI;
|
private JCheckBox chckbxBlackAI;
|
||||||
private JCheckBox chckbxWhiteAI;
|
private JCheckBox chckbxWhiteAI;
|
||||||
|
private SoundEffect soundEffect = new SoundEffect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the frame.
|
* Create the frame.
|
||||||
|
|
@ -193,6 +195,7 @@ public class MyInterface extends JFrame {
|
||||||
} else {
|
} else {
|
||||||
game.toggleAI(isWhite);
|
game.toggleAI(isWhite);
|
||||||
}
|
}
|
||||||
|
soundEffect.aiSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clicLoadFileButton() {
|
public void clicLoadFileButton() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue