-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlayerControlPanel.java
38 lines (30 loc) · 984 Bytes
/
PlayerControlPanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package csci576;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
public class PlayerControlPanel extends JButton {
public PlayerControlPanel(String label) {
this.setFont(new Font("TimeNewRoman", Font.BOLD, 14));
this.setText(label);
this.addMouseListener(
new MouseAdapter() {
public void mousePressed(MouseEvent e) {
pressTheButton(getText());
}
}
);
}
public void pressTheButton(String label) {
if (label.equals(Constants.START)) {
VideoPlayer.resume();
AudioPlayer.resumeAudio();
} else if (label.equals(Constants.PAUSE)) {
VideoPlayer.suspend();
AudioPlayer.pauseAudio();
} else if (label.equals(Constants.STOP)) {
VideoPlayer.stop();
AudioPlayer.stop();
}
}
}