1   package org.wcb.gui.dialog;
2   
3   
4   import org.wcb.gui.forms.AboutPanel;
5   import org.wcb.gui.component.WaveButton;
6   import org.wcb.gui.component.JXTitlePanel;
7   import org.wcb.resources.MessageResourceRegister;
8   import org.wcb.resources.MessageKey;
9   import org.jdesktop.swingx.border.DropShadowBorder;
10  
11  import javax.swing.*;
12  import javax.swing.border.Border;
13  import javax.swing.border.CompoundBorder;
14  import java.awt.*;
15  import java.awt.event.ActionListener;
16  
17  /**
18   * <small>
19   * Copyright (c)  2006  wbogaardt.
20   * Permission is granted to copy, distribute and/or modify this document
21   * under the terms of the GNU Free Documentation License, Version 1.2
22   * or any later version published by the Free Software Foundation;
23   * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
24   * Texts.  A copy of the license is included in the section entitled "GNU
25   * Free Documentation License".
26   * <p/>
27   * $File:  $ <br>
28   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Mar 30, 2006 10:35:19 AM $ <br>
29   * </small>
30   *
31   * @author wbogaardt
32   * @version 1
33   *          Date: Mar 30, 2006
34   *          Time: 10:35:19 AM
35   */
36  
37  public class AboutDialog extends JDialog  {
38  
39      private JButton okButton;
40  
41      public AboutDialog() {
42          setTitle("About Pilot's Log");
43          setModal(true);
44          setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
45          initComponents();
46      }
47  
48      public void addActionListener(ActionListener listener) {
49          okButton.addActionListener(listener);
50      }
51  
52      /**
53       * Init the componets in the dialog.
54       */
55      private void initComponents() {
56          okButton = new WaveButton(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLOSE));
57  
58          getContentPane().setLayout(new BorderLayout());
59          JPanel mainPanel =  new JXTitlePanel("About Pilots Log", new Color(0x522aec));
60          Border shadow = new DropShadowBorder(Color.BLACK, 1, 10, .5f, 15, false, true, true, true);
61          mainPanel.setBorder(new CompoundBorder(shadow, mainPanel.getBorder()));
62          mainPanel.setLayout(new GridBagLayout());
63          GridBagConstraints gridBagConstraints;
64          gridBagConstraints = new GridBagConstraints();
65          gridBagConstraints.gridx = 0;
66          gridBagConstraints.gridy = 0;
67          gridBagConstraints.anchor = GridBagConstraints.CENTER;
68          mainPanel.add(new AboutPanel(), gridBagConstraints);
69  
70          gridBagConstraints = new GridBagConstraints();
71          gridBagConstraints.gridx = 0;
72          gridBagConstraints.gridy = 1;
73          gridBagConstraints.anchor = GridBagConstraints.WEST;
74          mainPanel.add(okButton, gridBagConstraints);
75  
76          getContentPane().add(mainPanel, BorderLayout.SOUTH);
77          pack();
78      }
79  }