source: trunk/gli/src/org/greenstone/gatherer/gui/AboutDialog.java@ 8243

Last change on this file since 8243 was 8243, checked in by mdewsnip, 20 years ago

Removed all occurrences of classes explicitly importing other classes in the same package.

  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
RevLine 
[5032]1/**
2 *#########################################################################
3 *
[6382]4 * A component of the Greenstone Librarian Interface (GLI) application,
5 * part of the Greenstone digital library software suite from the New
6 * Zealand Digital Library Project at the University of Waikato,
7 * New Zealand.
[5032]8 *
[6382]9 * Author: John Thompson
10 * Greenstone Project, New Zealand Digital Library
11 * University of Waikato
12 * http://www.nzdl.org
[5032]13 *
[6382]14 * Copyright (C) 2004 New Zealand Digital Library, University of Waikato
[5032]15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 *########################################################################
30 */
[5589]31package org.greenstone.gatherer.gui;
32
[5032]33import java.awt.*;
34import java.awt.event.*;
35import javax.swing.*;
36import org.greenstone.gatherer.Dictionary;
37import org.greenstone.gatherer.util.Utility;
[5589]38
[6382]39/** Generates a pretty about dialog which not only thanks those for their contributions but also meets our legal requirements if we wish to ship the JVM with GLI.
40 * @author John Thompson, Greenstone Project, New Zealand Digital Library, University of Waikato
41 * @version 2.41 final
[5032]42 */
43// RICOH SOURCE CODE PUBLIC LICENSE - http://www.risource.org/RPL/RPL-1.0A.shtml
44public class AboutDialog
45 extends JDialog {
[6382]46 /** The default size of the about dialog. */
47 static final private Dimension SIZE = new Dimension(600, 325);
48 /** The size of the GLI icon to display on dialog. */
49 static final private int ICON_SIZE = 65;
50 /** A reference to ourself so that our inner classes can dismiss us. */
[5032]51 private AboutDialog self;
[6382]52 /** The button used for dismissing the about dialog. */
[5032]53 private JButton close_button;
[6382]54 /** The constructor not only builds, but displays the about dialog. This method doesn't return until the dialog is dismissed.
55 * @param parent the JFrame which owns this dialog for use in centering the dialog
56 * @see org.greenstone.gatherer.Dictionary#get
57 * @see org.greenstone.gatherer.Dictionary#setBoth
58 * @see org.greenstone.gatherer.Dictionary#setText
59 * @see org.greenstone.gatherer.gui.AboutDialog.CloseButtonListener
60 * @see org.greenstone.gatherer.gui.GLIButton
61 * @see org.greenstone.gatherer.util.Utility#getImage
62 * @see org.greenstone.gatherer.util.Utility#PROGRAM_NAME
63 * @see org.greenstone.gatherer.util.Utility#PROGRAM_VERSION
64 */
[5032]65 public AboutDialog(JFrame parent) {
[5593]66 super(parent, Dictionary.get("AboutDialog.Title"), true);
[5032]67 this.self = this;
68 setSize(SIZE);
69
70 JPanel content_pane = (JPanel) getContentPane();
71 JPanel upper_pane = new JPanel();
72 ImageIcon icon = Utility.getImage("medgath.gif");
73 ImageIcon scaled_icon = new ImageIcon(icon.getImage().getScaledInstance(ICON_SIZE, ICON_SIZE, Image.SCALE_DEFAULT));
74 JLabel icon_label = new JLabel(scaled_icon);
75 JPanel title_pane = new JPanel();
[5589]76 JLabel title_one_label = new JLabel();
77 Dictionary.setText(title_one_label, "AboutDialog.Title_One");
[5593]78 JLabel title_two_label = new JLabel(Utility.PROGRAM_NAME + " " + Utility.PROGRAM_VERSION + " " + Dictionary.get("AboutDialog.Date"));
[5589]79 JLabel title_three_label = new JLabel();
80 Dictionary.setText(title_three_label, "AboutDialog.Title_Two");
81 JLabel copyright_label = new JLabel();
82 Dictionary.setText(copyright_label, "AboutDialog.Copyright");
[6206]83 JLabel gpl_label = new JLabel();
84 Dictionary.setText(gpl_label, "AboutDialog.Copyright_Two");
[5589]85
[5032]86 JTextArea text = new JTextArea();
87 text.setLineWrap(true);
88 text.setWrapStyleWord(true);
[5589]89
[5032]90 JPanel button_pane = new JPanel();
[6318]91 close_button = new GLIButton();
92 close_button.setMnemonic(KeyEvent.VK_C);
[5589]93 Dictionary.setBoth(close_button, "General.Close", "General.Close_Tooltip");
[5032]94
95 // Connection
96 close_button.addActionListener(new CloseButtonListener());
97
98 // Layout
99 icon_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,10));
100
[6206]101 title_pane.setLayout(new GridLayout(5,1,0,2));
[5032]102 title_pane.add(title_one_label);
103 title_pane.add(title_two_label);
104 title_pane.add(title_three_label);
105 title_pane.add(copyright_label);
[6206]106 title_pane.add(gpl_label);
[5032]107
108 upper_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
109 upper_pane.setLayout(new BorderLayout());
110 upper_pane.add(icon_label, BorderLayout.WEST);
111 upper_pane.add(title_pane, BorderLayout.CENTER);
112
113 button_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
114 button_pane.setLayout(new BorderLayout());
115 button_pane.add(close_button, BorderLayout.EAST);
116
117 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
118 content_pane.setLayout(new BorderLayout());
119 content_pane.add(upper_pane, BorderLayout.NORTH);
120 content_pane.add(new JScrollPane(text), BorderLayout.CENTER);
121 content_pane.add(button_pane, BorderLayout.SOUTH);
[5589]122
[5032]123 // Build text content
[5593]124 text.append(Dictionary.get("AboutDialog.Java_Req"));
[5032]125 text.append("\n");
[5593]126 text.append(Dictionary.get("AboutDialog.Java_Req_One"));
[5032]127 text.append("\n");
[5593]128 text.append(Dictionary.get("AboutDialog.Java_Req_Two"));
[5032]129 text.append("\n\n");
[5593]130 text.append("*****" + Dictionary.get("AboutDialog.Acknowledgement") + "*****");
[5032]131 text.append("\n\n");
[5593]132 text.append(Dictionary.get("AboutDialog.Item0"));
[5032]133 text.append("\n\n");
[5593]134 text.append(Dictionary.get("AboutDialog.Item1"));
[5032]135 text.append("\n\n");
[5593]136 text.append(Dictionary.get("AboutDialog.Item2"));
[5032]137 text.append("\n\n");
[5593]138 text.append(Dictionary.get("AboutDialog.Item3"));
[5032]139 text.append("\n\n");
[5593]140 text.append("*****" + Dictionary.get("AboutDialog.Thanks") + "*****");
[5032]141 text.append("\n\n");
[5593]142 text.append(Dictionary.get("AboutDialog.Item4"));
[5032]143 text.append("\n\n");
[5593]144 text.append(Dictionary.get("AboutDialog.Item5"));
[5032]145 text.append("\n\n");
[5593]146 text.append(Dictionary.get("AboutDialog.Item6"));
[5032]147 text.append("\n\n");
[5593]148 text.append(Dictionary.get("AboutDialog.Item7"));
[5343]149 text.append("\n\n");
[5593]150 text.append(Dictionary.get("AboutDialog.Item8"));
[6206]151 text.append("\n\n");
152 text.append(Dictionary.get("AboutDialog.Item9"));
[5032]153 text.setCaretPosition(0);
154
155 // Show
156 Rectangle frame_bounds = parent.getBounds();
157 setLocation(frame_bounds.x + (frame_bounds.width - SIZE.width) / 2, frame_bounds.y + (frame_bounds.height - SIZE.height) / 2);
158 show();
159 }
[6382]160 /** Listens for actions upon the close button, and when detected closes the dialog. */
[5032]161 private class CloseButtonListener
162 implements ActionListener {
[6382]163 /** Called whenever an action occurs on the close button, thus asking the dialog to close.
164 * @param event an ActionEvent containing information about the button press
165 */
[5032]166 public void actionPerformed(ActionEvent event) {
167 self.hide();
168 self.dispose();
169 }
170 }
171}
Note: See TracBrowser for help on using the repository browser.