1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.db.gui;
18
19
20 import javax.swing.*;
21 import java.awt.*;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.awt.event.WindowEvent;
25
26
27 /***
28 * An about dialog for the introspector GUI.
29 *
30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31 * @version $Rev: 159259 $
32 */
33 public class AboutDialog extends JDialog
34 {
35 private static final long serialVersionUID = 3257853194544952884L;
36
37 private String title = "About";
38 private String product = "Eve jdbm partition inspector";
39 private String version = "0.1";
40 private String copyright = "Copyright (c) 2003";
41 private String comments =
42 "This is the jdbm partition viewer or introspector.\nIrregular behavior "
43 + "can be analyzed by using this tool to inspect\nthe state of system "
44 + "indices and entry attributes within the partition's database.";
45 private JPanel contentPane = new JPanel();
46 private JLabel prodLabel = new JLabel();
47 private JLabel verLabel = new JLabel();
48 private JLabel copLabel = new JLabel();
49 private JTextArea commentField = new JTextArea();
50 private JPanel btnPanel = new JPanel();
51 private JButton okButton = new JButton();
52 private JLabel image = new JLabel();
53 private BorderLayout formLayout = new BorderLayout();
54 private GridBagLayout contentPaneLayout = new GridBagLayout();
55 private FlowLayout btnPaneLayout = new FlowLayout();
56 private JPanel jPanel1 = new JPanel();
57 private JPanel jPanel2 = new JPanel();
58
59
60 /*** Creates new About Dialog */
61 public AboutDialog(Frame parent, boolean modal)
62 {
63 super(parent, modal);
64 initGUI();
65 pack();
66 }
67
68
69 public AboutDialog()
70 {
71 super();
72 setModal(true);
73 initGUI();
74 pack();
75 }
76
77
78 /*** This method is called from within the constructor to initialize the dialog. */
79 private void initGUI()
80 {
81 addWindowListener(
82 new java.awt.event.WindowAdapter() {
83 public void windowClosing(WindowEvent evt) {
84 closeDialog(evt);
85 }
86 });
87 getContentPane().setLayout(formLayout);
88 contentPane.setLayout(contentPaneLayout);
89 contentPane.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(
90 new java.awt.Color(153, 153, 153), 1), "Directory Project: Eve", javax.swing.border.TitledBorder.LEADING, javax.swing.border.TitledBorder.TOP,
91 new java.awt.Font("SansSerif", 0, 14), new java.awt.Color(60, 60, 60)));
92 prodLabel.setText(product);
93 prodLabel.setAlignmentX(0.5f);
94 contentPane.add(prodLabel,
95 new java.awt.GridBagConstraints(java.awt.GridBagConstraints.RELATIVE, java.awt.GridBagConstraints.RELATIVE,
96 java.awt.GridBagConstraints.REMAINDER, 1, 0.0, 0.0, java.awt.GridBagConstraints.NORTHWEST, java.awt.GridBagConstraints.NONE,
97 new java.awt.Insets(5, 5, 0, 0), 5, 0));
98 verLabel.setText(version);
99 contentPane.add(verLabel,
100 new java.awt.GridBagConstraints(java.awt.GridBagConstraints.RELATIVE, java.awt.GridBagConstraints.RELATIVE,
101 java.awt.GridBagConstraints.REMAINDER, 1, 0.0, 0.0, java.awt.GridBagConstraints.NORTHWEST, java.awt.GridBagConstraints.NONE,
102 new java.awt.Insets(5, 5, 0, 0), 0, 0));
103 copLabel.setText(copyright);
104 contentPane.add(copLabel,
105 new java.awt.GridBagConstraints(java.awt.GridBagConstraints.RELATIVE, java.awt.GridBagConstraints.RELATIVE,
106 java.awt.GridBagConstraints.REMAINDER, 1, 0.0, 0.0, java.awt.GridBagConstraints.NORTHWEST, java.awt.GridBagConstraints.NONE,
107 new java.awt.Insets(5, 5, 0, 0), 0, 0));
108 commentField.setBackground(getBackground());
109 commentField.setForeground(copLabel.getForeground());
110 commentField.setFont(copLabel.getFont());
111 commentField.setText(comments);
112 commentField.setEditable(false);
113 commentField.setBorder(null);
114 contentPane.add(commentField,
115 new java.awt.GridBagConstraints(java.awt.GridBagConstraints.RELATIVE, java.awt.GridBagConstraints.RELATIVE,
116 java.awt.GridBagConstraints.REMAINDER, 3, 0.0, 1.0, java.awt.GridBagConstraints.NORTHWEST, java.awt.GridBagConstraints.BOTH,
117 new java.awt.Insets(5, 5, 5, 0), 0, 0));
118
119 image.setText("Eve");
120 image.setIcon( new ImageIcon( getClass().getResource( "server.gif" ) ) );
121
122 image.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
123 image.setMinimumSize(new java.awt.Dimension(98,44));
124 image.setMaximumSize(new java.awt.Dimension(98,44));
125 image.setAlignmentX(0.5f);
126 image.setBorder(javax.swing.BorderFactory.createEmptyBorder());
127 image.setPreferredSize(new java.awt.Dimension(98,44));
128 image.setSize(new java.awt.Dimension(98,200));
129 btnPanel.setLayout(btnPaneLayout);
130 okButton.setText("OK");
131 okButton.addActionListener(
132 new ActionListener() {
133 public void actionPerformed(ActionEvent e) {
134 setVisible(false);
135 dispose();
136 }
137 });
138 btnPanel.add(okButton);
139 getContentPane().add(image, BorderLayout.WEST);
140 getContentPane().add(contentPane, BorderLayout.CENTER);
141 getContentPane().add(btnPanel, BorderLayout.SOUTH);
142 getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
143 getContentPane().add(jPanel2, java.awt.BorderLayout.EAST);
144 setTitle(title);
145 setResizable(false);
146 setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12));
147 formLayout.setHgap(15);
148 jPanel1.setMinimumSize(new java.awt.Dimension(10, 30));
149 jPanel1.setPreferredSize(new java.awt.Dimension(10, 30));
150 jPanel1.setSize(new java.awt.Dimension(564, 35));
151 jPanel2.setMinimumSize(new java.awt.Dimension(72, 165));
152 jPanel2.setPreferredSize(new java.awt.Dimension(80, 165));
153 jPanel2.setSize(new java.awt.Dimension(72, 170));
154 jPanel2.setMaximumSize(new java.awt.Dimension(80,165));
155 }
156
157
158 /*** Closes the dialog */
159 private void closeDialog(WindowEvent evt)
160 {
161 evt.getWindow();
162 setVisible( false );
163 dispose();
164 }
165 }