-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.java
More file actions
47 lines (30 loc) · 851 Bytes
/
Copy pathMainWindow.java
File metadata and controls
47 lines (30 loc) · 851 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
36
37
38
39
40
41
42
43
44
45
46
47
package orbit;
import java.awt.Component;
import java.awt.event.WindowAdapter;
//import java.awt.EventQueue;
import javax.swing.JFrame;
public class MainWindow extends JFrame {
private static final long serialVersionUID = 1L;
MainWindow(String title,Component plane, Input input){
setTitle(title);
add(plane);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
this.setLocationRelativeTo(null);
addKeyListener(input);
addMouseListener(input);
addMouseMotionListener(input);
setVisible(true);
requestFocus();
addWindowListener(new WindowAdapter() {
@Override
public void windowActivated(java.awt.event.WindowEvent arg0) {
MainWindow.this.requestFocus();
}
@Override
public void windowClosing(java.awt.event.WindowEvent arg0) {
System.out.println("Good bye!");
}
});
}
}