1
/* Anagram Game Application */
3
package com.toy.anagrams.ui;
5
import java.awt.Dimension;
7
import java.awt.Rectangle;
8
import java.awt.event.ActionListener;
9
import javax.swing.JDialog;
10
import javax.swing.JFrame;
13
* About dialog of the Anagram Game application.
15
public class About extends JDialog {
17
/** Creates new form About */
18
public About(JFrame parent) {
22
Rectangle parentBounds = parent.getBounds();
23
Dimension size = getSize();
24
// Center in the parent
25
int x = Math.max(0, parentBounds.x + (parentBounds.width - size.width) / 2);
26
int y = Math.max(0, parentBounds.y + (parentBounds.height - size.height) / 2);
27
setLocation(new Point(x, y));
30
/** This method is called from within the constructor to
31
* initialize the form.
32
* WARNING: Do NOT modify this code. The content of this method is
33
* always regenerated by the Form Editor.
35
private void initComponents() {//GEN-BEGIN:initComponents
36
java.awt.GridBagConstraints gridBagConstraints;
38
mainPanel = new javax.swing.JPanel();
39
copyrightTextArea = new javax.swing.JTextArea();
40
closeButton = new javax.swing.JButton();
42
getContentPane().setLayout(new java.awt.GridBagLayout());
44
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
45
setTitle("About Anagrams");
46
mainPanel.setLayout(new java.awt.GridBagLayout());
48
mainPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(11, 11, 12, 12)));
49
copyrightTextArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Panel.background"));
50
copyrightTextArea.setColumns(25);
51
copyrightTextArea.setEditable(false);
52
copyrightTextArea.setLineWrap(true);
53
copyrightTextArea.setRows(8);
54
copyrightTextArea.setText("Anagrams\n\nCopyright (c) 2003 Irritable Enterprises, Inc.");
55
copyrightTextArea.setWrapStyleWord(true);
56
copyrightTextArea.setBorder(null);
57
copyrightTextArea.setFocusable(false);
58
gridBagConstraints = new java.awt.GridBagConstraints();
59
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
60
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
61
gridBagConstraints.weightx = 1.0;
62
gridBagConstraints.weighty = 1.0;
63
gridBagConstraints.insets = new java.awt.Insets(24, 0, 24, 0);
64
mainPanel.add(copyrightTextArea, gridBagConstraints);
66
closeButton.setMnemonic('C');
67
closeButton.setText("Close");
68
closeButton.addActionListener(new java.awt.event.ActionListener() {
69
public void actionPerformed(java.awt.event.ActionEvent evt) {
70
closeButtonActionPerformed(evt);
74
gridBagConstraints = new java.awt.GridBagConstraints();
75
gridBagConstraints.gridx = 0;
76
gridBagConstraints.gridy = 1;
77
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
78
mainPanel.add(closeButton, gridBagConstraints);
80
gridBagConstraints = new java.awt.GridBagConstraints();
81
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
82
gridBagConstraints.weightx = 1.0;
83
gridBagConstraints.weighty = 1.0;
84
getContentPane().add(mainPanel, gridBagConstraints);
86
}//GEN-END:initComponents
88
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
91
}//GEN-LAST:event_closeButtonActionPerformed
94
// Variables declaration - do not modify//GEN-BEGIN:variables
95
private javax.swing.JButton closeButton;
96
private javax.swing.JTextArea copyrightTextArea;
97
private javax.swing.JPanel mainPanel;
98
// End of variables declaration//GEN-END:variables