1 /***
2 * AboutDialog.java
3 *
4 * Project: Dependency Tool
5 *
6 * WHEN WHO WHAT
7 * 06.06.2003 pko initial public release
8 * 20.02.2003 pko creation
9 *
10 * Copyright 2003 ELCA Informatique SA
11 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland
12 * www.elca.ch
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public License
16 * as published by the Free Software Foundation; either version 2.1 of
17 * the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 * USA
28 */
29
30 package ch.elca.dependency.gui;
31
32 import java.awt.*;
33 import java.awt.event.MouseAdapter;
34 import java.awt.event.MouseEvent;
35 import javax.swing.*;
36 import javax.swing.border.EmptyBorder;
37
38 /***
39 * The About Dialog of the Dependency Tool.
40 *
41 * @author Pawel Kowalski
42 * @version 1.0-beta
43 */
44 public class AboutDialog extends JDialog {
45
46 //****************************************************************************************/
47 // instance variables
48 //****************************************************************************************/
49
50 private static AboutDialog s_instance = null;
51
52 //****************************************************************************************/
53 // c'tor
54 //****************************************************************************************/
55
56 /***
57 * Creates a new <code>AboutDialog</code> instance.
58 *
59 * @param owner a <code>Frame</code> value
60 * @param title a <code>String</code> value
61 * @param modal a <code>boolean</code> value
62 */
63 private AboutDialog(Frame owner, String title, boolean modal) {
64 super(owner, title, modal);
65 }
66
67 //****************************************************************************************/
68 // public methods
69 //****************************************************************************************/
70
71 /***
72 * Show the AboutDialog of the Dependency Tool.
73 *
74 * @param owner a <code>Frame</code> value
75 */
76 public static void showAboutDialog(Frame owner) {
77 getAboutDialog(owner).show();
78 }
79
80 /***
81 * Get the AboutDialog and if it doesn't exist yet, create one.
82 *
83 * @param owner a <code>Frame</code> value
84 * @return an <code>AboutDialog</code> value
85 */
86 private static AboutDialog getAboutDialog(Frame owner) {
87
88 // create about if not yet created
89 //
90 if (s_instance == null) {
91 s_instance = new AboutDialog(owner, "About Dependency Tool...", false);
92 s_instance.addMouseListener(new MouseAdapter() {
93 public void mouseClicked(MouseEvent e) {
94 s_instance.setVisible(false);
95 }
96 });
97 JLabel copyright = new JLabel("Copyright (c) 2003 ELCA Informatique SA", JLabel.CENTER);
98 JLabel rights = new JLabel("Distributed under the LGPL", JLabel.CENTER);
99 JLabel version = new JLabel("Dependency Tool Version: 1.0-beta ", JLabel.CENTER);
100 JPanel infos = new JPanel();
101 infos.setOpaque(false);
102 infos.setLayout(new GridLayout(0, 1));
103 infos.setBorder(new EmptyBorder(20, 20, 20, 20));
104 infos.add(copyright);
105 infos.add(rights);
106 infos.add(version);
107
108 JLabel lead = new JLabel("Project Leaders:", JLabel.LEFT);
109 JLabel bry = new JLabel("B. Rytz (bernhard.rytz@elca.ch)", JLabel.CENTER);
110 JLabel los = new JLabel("L. Ostinelli (laurent.ostinelli@elca.ch)", JLabel.CENTER);
111 JLabel bsa = new JLabel("B. Saxer", JLabel.CENTER);
112 JLabel blank = new JLabel("");
113 JLabel programmers = new JLabel("Developped by:", JLabel.LEFT);
114 JLabel ctr = new JLabel("Ch. Trutmann", JLabel.CENTER);
115 JLabel pko = new JLabel("P. Kowalski (pawel.kowalski@elca.ch)", JLabel.CENTER);
116 JPanel staff = new JPanel();
117 staff.setOpaque(false);
118 staff.setLayout(new GridLayout(0, 1));
119 staff.setBorder(new EmptyBorder(20, 20, 20, 20));
120 staff.add(lead);
121 staff.add(bry);
122 staff.add(los);
123 staff.add(bsa);
124 staff.add(blank);
125 staff.add(programmers);
126 staff.add(ctr);
127 staff.add(pko);
128
129 Container panel = s_instance.getContentPane();
130 panel.setLayout(new BorderLayout());
131 panel.setBackground(Color.white);
132 panel.add(infos, BorderLayout.NORTH);
133 panel.add(staff, BorderLayout.SOUTH);
134 }
135
136 // center AboutDialog
137 //
138 Point p = owner.getLocationOnScreen();
139 Dimension d1 = owner.getSize();
140 s_instance.pack();
141 Dimension d2 = s_instance.getSize();
142 s_instance.setVisible(true);
143 s_instance.setLocation(p.x + (d1.width - d2.width) / 2, p.y + (d1.height - d2.height) / 2);
144 s_instance.setResizable(false);
145 return s_instance;
146 }
147 }
This page was automatically generated by Maven