~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to ant/freeform/samples/templates/anagram/src/com/toy/anagrams/ui/About.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Anagram Game Application */
 
2
 
 
3
package com.toy.anagrams.ui;
 
4
 
 
5
import java.awt.Dimension;
 
6
import java.awt.Point;
 
7
import java.awt.Rectangle;
 
8
import java.awt.event.ActionListener;
 
9
import javax.swing.JDialog;
 
10
import javax.swing.JFrame;
 
11
 
 
12
/**
 
13
 * About dialog of the Anagram Game application.
 
14
 */
 
15
public class About extends JDialog {
 
16
 
 
17
    /** Creates new form About */
 
18
    public About(JFrame parent) {
 
19
        super(parent,true);
 
20
        initComponents();
 
21
        pack();
 
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));
 
28
    }
 
29
 
 
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.
 
34
     */
 
35
    private void initComponents() {//GEN-BEGIN:initComponents
 
36
        java.awt.GridBagConstraints gridBagConstraints;
 
37
 
 
38
        mainPanel = new javax.swing.JPanel();
 
39
        copyrightTextArea = new javax.swing.JTextArea();
 
40
        closeButton = new javax.swing.JButton();
 
41
 
 
42
        getContentPane().setLayout(new java.awt.GridBagLayout());
 
43
 
 
44
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 
45
        setTitle("About Anagrams");
 
46
        mainPanel.setLayout(new java.awt.GridBagLayout());
 
47
 
 
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);
 
65
 
 
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);
 
71
            }
 
72
        });
 
73
 
 
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);
 
79
 
 
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);
 
85
 
 
86
    }//GEN-END:initComponents
 
87
 
 
88
    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
 
89
        setVisible(false);
 
90
        dispose();
 
91
    }//GEN-LAST:event_closeButtonActionPerformed
 
92
 
 
93
 
 
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
 
99
 
 
100
}