-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframe.java
More file actions
35 lines (30 loc) · 912 Bytes
/
frame.java
File metadata and controls
35 lines (30 loc) · 912 Bytes
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
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class frame implements ActionListener {
panel p = new panel();
JFrame f = new JFrame();
JButton rb = new JButton();
frame() {
f.setTitle("Pong Game");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
f.setResizable(false);
f.setBounds(500, 200, 800, 600);
rb.setBounds(0, 0, 1000, 1000);
rb.addActionListener(this);
f.add(rb);
f.setFocusable(true);
f.add(p);
}
public static void main(String[] args) {
new frame();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == this.rb && (p.ps == 5 || p.cs == 5)) {
new frame();
f.dispose();
}
}
}