-
Notifications
You must be signed in to change notification settings - Fork 4
/
JapeAbout.java
78 lines (65 loc) · 2.09 KB
/
JapeAbout.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
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
70
71
72
73
74
75
76
77
78
/*
Written 1999 by Douglas Greiman.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
*/
package duggelz.jape;
import java.awt.*;
import java.awt.event.*;
//import java.io.File;
//import java.io.IOException;
public class JapeAbout extends Dialog {
public JapeAbout(Frame parent)
{
super(parent, "About JAPE", true);
// Create body panel
Panel body = new Panel();
body.setLayout(new BorderLayout());
this.add(body);
// Add icon
// Text Panel
Panel textPanel = new InsetPanel(5, 5, 5, 5);
textPanel.setLayout(new GridLayout(4,1));
textPanel.setBackground(SystemColor.text);
Label line1 = new Label("JAPE: A Jagged Alliance 2 Save Game Editor", Label.CENTER);
textPanel.add(line1);
Label line2 = new Label("Version 0.41", Label.CENTER);
textPanel.add(line2);
Label line3 = new Label("Copyright (c) 2008 Douglas Greiman", Label.CENTER);
textPanel.add(line3);
Label line4 = new Label("http://www.duggelz.org/", Label.CENTER);
textPanel.add(line4);
// Button bar
Panel buttonPanel = new InsetPanel(0, 5, 0, 5);
buttonPanel.setLayout(new FlowLayout());
Button okButton = new Button("OK");
okButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}});
buttonPanel.add(okButton);
// Add elements to dialog
body.add(buttonPanel, "South");
body.add(textPanel, "Center");
// Handle window events
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}});
// Instantiate peers for the size calculation below
this.addNotify();
this.pack();
// Put this dialog in the center of the parent frame
if( parent != null )
{
Point parentLoc = parent.getLocation();
Dimension parentSize = parent.getSize();
Dimension size = this.getSize();
Point loc = new Point(
parentLoc.x + (parentSize.width - size.width)/2,
parentLoc.y + (parentSize.height - size.height)/2
);
this.setLocation(loc);
}
}
}