001: /* Anagram Game Application */
002:
003: package com.toy.anagrams.ui;
004:
005: import java.awt.Dimension;
006: import java.awt.Point;
007: import java.awt.Rectangle;
008: import java.awt.event.ActionListener;
009: import javax.swing.JDialog;
010: import javax.swing.JFrame;
011:
012: /**
013: * About dialog of the Anagram Game application.
014: */
015: public class About extends JDialog {
016:
017: /** Creates new form About */
018: public About(JFrame parent) {
019: super (parent, true);
020: initComponents();
021: pack();
022: Rectangle parentBounds = parent.getBounds();
023: Dimension size = getSize();
024: // Center in the parent
025: int x = Math.max(0, parentBounds.x
026: + (parentBounds.width - size.width) / 2);
027: int y = Math.max(0, parentBounds.y
028: + (parentBounds.height - size.height) / 2);
029: setLocation(new Point(x, y));
030: }
031:
032: /** This method is called from within the constructor to
033: * initialize the form.
034: * WARNING: Do NOT modify this code. The content of this method is
035: * always regenerated by the Form Editor.
036: */
037: private void initComponents() {//GEN-BEGIN:initComponents
038: java.awt.GridBagConstraints gridBagConstraints;
039:
040: mainPanel = new javax.swing.JPanel();
041: copyrightTextArea = new javax.swing.JTextArea();
042: closeButton = new javax.swing.JButton();
043:
044: getContentPane().setLayout(new java.awt.GridBagLayout());
045:
046: setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
047: setTitle("About Anagrams");
048: mainPanel.setLayout(new java.awt.GridBagLayout());
049:
050: mainPanel.setBorder(new javax.swing.border.EmptyBorder(
051: new java.awt.Insets(11, 11, 12, 12)));
052: copyrightTextArea.setBackground(javax.swing.UIManager
053: .getDefaults().getColor("Panel.background"));
054: copyrightTextArea.setColumns(25);
055: copyrightTextArea.setEditable(false);
056: copyrightTextArea.setLineWrap(true);
057: copyrightTextArea.setRows(8);
058: copyrightTextArea
059: .setText("Anagrams\n\nCopyright (c) 2003 Irritable Enterprises, Inc.");
060: copyrightTextArea.setWrapStyleWord(true);
061: copyrightTextArea.setBorder(null);
062: copyrightTextArea.setFocusable(false);
063: gridBagConstraints = new java.awt.GridBagConstraints();
064: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
065: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
066: gridBagConstraints.weightx = 1.0;
067: gridBagConstraints.weighty = 1.0;
068: gridBagConstraints.insets = new java.awt.Insets(24, 0, 24, 0);
069: mainPanel.add(copyrightTextArea, gridBagConstraints);
070:
071: closeButton.setMnemonic('C');
072: closeButton.setText("Close");
073: closeButton
074: .addActionListener(new java.awt.event.ActionListener() {
075: public void actionPerformed(
076: java.awt.event.ActionEvent evt) {
077: closeButtonActionPerformed(evt);
078: }
079: });
080:
081: gridBagConstraints = new java.awt.GridBagConstraints();
082: gridBagConstraints.gridx = 0;
083: gridBagConstraints.gridy = 1;
084: gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
085: mainPanel.add(closeButton, gridBagConstraints);
086:
087: gridBagConstraints = new java.awt.GridBagConstraints();
088: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
089: gridBagConstraints.weightx = 1.0;
090: gridBagConstraints.weighty = 1.0;
091: getContentPane().add(mainPanel, gridBagConstraints);
092:
093: }//GEN-END:initComponents
094:
095: private void closeButtonActionPerformed(
096: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
097: setVisible(false);
098: dispose();
099: }//GEN-LAST:event_closeButtonActionPerformed
100:
101: // Variables declaration - do not modify//GEN-BEGIN:variables
102: private javax.swing.JButton closeButton;
103: private javax.swing.JTextArea copyrightTextArea;
104: private javax.swing.JPanel mainPanel;
105: // End of variables declaration//GEN-END:variables
106:
107: }
|