-
Notifications
You must be signed in to change notification settings - Fork 0
/
AboutDialog.java
59 lines (56 loc) · 2.02 KB
/
AboutDialog.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
/*
* Copyright (C) 2010 WeaveBytes, Inc.,
*
* Confidential, all rights reserved. No distribution is permitted.
___ _______ ____ ________
\ \ __ / __| / \ / ___|
\ \ / \ / |_ / /\ \ / |_
\ \/ \/ /| _| / /__\ \/ /| _|
\ /\ / | |__/ ______ / | |___
\__/ \__/ |_______/ \ _/ |______|
___ __
______ | | ________ __ __ | |
/ ___| | | / __ \ | | | | _______| |
| | | | | | | | | | | | / ____| |
| |____| |__ | |__| |__| \____/ | \ \____| |
\_______|______\________/__ \________/__ \_________|
*/
//Description: Count.java class is used for counting words in string
//Creation Date: August 17, 2011
//Authors : Simranpal Singh, Varinder Pal Singh
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class AboutDialog extends JDialog implements ActionListener {
public AboutDialog(JFrame parent, String title, String message) {
super(parent, title, true);
if (parent != null) {
Dimension parentSize = parent.getSize();
Point p = parent.getLocation();
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
}
JPanel messagePane = new JPanel();
messagePane.add(new JLabel(message));
getContentPane().add(messagePane);
JPanel buttonPane = new JPanel();
JButton button = new JButton("OK");
buttonPane.add(button);
button.addActionListener(this);
getContentPane().add(buttonPane, BorderLayout.SOUTH);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pack();
setSize(400, 300);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
}
}