-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAboutWindow.java
More file actions
71 lines (58 loc) · 1.93 KB
/
AboutWindow.java
File metadata and controls
71 lines (58 loc) · 1.93 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.util.ArrayList;
/** Window that pops up when user selects "About Ship Radar" from the menubar.
*
* @author Gemma Smith <gemma.smith@tufts.edu>
* @version 1.0
* @since 2013-12-09
*/
public class AboutWindow extends JFrame implements ActionListener
{
private JFrame window;
private Main main;
public AboutWindow(Main mn)
{
super("About");
main = mn;
window = this;
setSize(425,175);
setLocation(100,100);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setOpaque(true);
panel.setBackground(Color.WHITE);
JLabel title = new JLabel ("About Ship Radar", JLabel.CENTER);
title.setFont(new Font("SansSerif", Font.BOLD, 16));
title.setForeground(Color.RED);
title.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(title);
JLabel aboutText = new JLabel ("<html><body><br>"+
"Author: Gemma Smith<br>"+
"Version: 5.0 <br>"+
"Tufts, COMP 86<br>"+
"Object-Oriented Programming for Graphical User Interfaces<br>"+
"Fall 2013<br>"+
"</body></html>", JLabel.CENTER);
aboutText.setFont(new Font("SansSerif", Font.BOLD, 12));
aboutText.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(aboutText);
MyButton close = new MyButton("Close", Color.BLACK, 12);
close.addActionListener(this);
close.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(close);
add(panel);
window.setVisible(false);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
/** Upon clicking "Close", the about window will close and the
* simulation will restart.
*/
public void actionPerformed(ActionEvent event)
{
main.closeWindow();
window.setVisible(false);
}
}