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

Last change on this file since 14775 was 14775, checked in by oranfry, 16 years ago

giving credit to the maker of the new folder and delete icons

  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1/**
2 *#########################################################################
3 *
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.
8 *
9 * Author: John Thompson
10 * Greenstone Project, New Zealand Digital Library
11 * University of Waikato
12 * http://www.nzdl.org
13 *
14 * Copyright (C) 2004 New Zealand Digital Library, University of Waikato
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 */
31package org.greenstone.gatherer.gui;
32
33import java.awt.*;
34import java.awt.event.*;
35import javax.swing.*;
36import org.greenstone.gatherer.Dictionary;
37import org.greenstone.gatherer.Gatherer;
38import org.greenstone.gatherer.util.JarTools;
39import org.greenstone.gatherer.util.Utility;
40
41/** 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.
42 * @author John Thompson, Greenstone Project, New Zealand Digital Library, University of Waikato
43 * @version 2.41 final
44 */
45// RICOH SOURCE CODE PUBLIC LICENSE - http://www.risource.org/RPL/RPL-1.0A.shtml
46public class AboutDialog
47 extends JDialog {
48 /** The default size of the about dialog. */
49 static final private Dimension SIZE = new Dimension(600, 325);
50 /** The size of the GLI icon to display on dialog. */
51 static final private int ICON_SIZE = 65;
52 /** A reference to ourself so that our inner classes can dismiss us. */
53 private AboutDialog self;
54 /** The button used for dismissing the about dialog. */
55 private JButton close_button;
56 /** The constructor not only builds, but displays the about dialog. This method doesn't return until the dialog is dismissed.
57 * @param parent the JFrame which owns this dialog for use in centering the dialog
58 * @see org.greenstone.gatherer.Dictionary#get
59 * @see org.greenstone.gatherer.Dictionary#setBoth
60 * @see org.greenstone.gatherer.Dictionary#setText
61 * @see org.greenstone.gatherer.gui.AboutDialog.CloseButtonListener
62 * @see org.greenstone.gatherer.gui.GLIButton
63 */
64 public AboutDialog(JFrame parent) {
65 super(parent, Dictionary.get("AboutDialog.Title"), true);
66 this.self = this;
67 setSize(SIZE);
68
69 JPanel content_pane = (JPanel) getContentPane();
70 JPanel upper_pane = new JPanel();
71 ImageIcon icon = JarTools.getImage("gatherer_medium.gif");
72 ImageIcon scaled_icon = new ImageIcon(icon.getImage().getScaledInstance(ICON_SIZE, ICON_SIZE, Image.SCALE_DEFAULT));
73 JLabel icon_label = new JLabel(scaled_icon);
74 JPanel title_pane = new JPanel();
75 JLabel title_one_label = new JLabel(Dictionary.get("AboutDialog.Title_One"));
76 JLabel title_two_label = new JLabel(Gatherer.PROGRAM_NAME + " " + Gatherer.PROGRAM_VERSION + " " + Dictionary.get("AboutDialog.Date"));
77 JLabel title_three_label = new JLabel(Dictionary.get("AboutDialog.Title_Two"));
78 JLabel copyright_label = new JLabel(Dictionary.get("AboutDialog.Copyright"));
79 JLabel gpl_label = new JLabel(Dictionary.get("AboutDialog.Copyright_Two"));
80
81 JTextArea text = new JTextArea();
82 text.setLineWrap(true);
83 text.setWrapStyleWord(true);
84
85 JPanel button_pane = new JPanel();
86 close_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip"));
87
88 // Connection
89 close_button.addActionListener(new CloseButtonListener());
90
91 // Layout
92 icon_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,10));
93
94 title_pane.setLayout(new GridLayout(5,1,0,2));
95 title_pane.add(title_one_label);
96 title_pane.add(title_two_label);
97 title_pane.add(title_three_label);
98 title_pane.add(copyright_label);
99 title_pane.add(gpl_label);
100
101 upper_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
102 upper_pane.setLayout(new BorderLayout());
103 upper_pane.add(icon_label, BorderLayout.WEST);
104 upper_pane.add(title_pane, BorderLayout.CENTER);
105
106 button_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
107 button_pane.setLayout(new BorderLayout());
108 button_pane.add(close_button, BorderLayout.EAST);
109
110 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
111 content_pane.setLayout(new BorderLayout());
112 content_pane.add(upper_pane, BorderLayout.NORTH);
113 content_pane.add(new JScrollPane(text), BorderLayout.CENTER);
114 content_pane.add(button_pane, BorderLayout.SOUTH);
115
116 // Build text content
117 text.append(Dictionary.get("AboutDialog.Java_Req"));
118 text.append("\n");
119 text.append(Dictionary.get("AboutDialog.Java_Req_One"));
120 text.append("\n");
121 text.append(Dictionary.get("AboutDialog.Java_Req_Two"));
122 text.append("\n\n");
123 text.append("*****" + Dictionary.get("AboutDialog.Acknowledgement") + "*****");
124 text.append("\n\n");
125 text.append(Dictionary.get("AboutDialog.Item0"));
126 text.append("\n\n");
127 text.append(Dictionary.get("AboutDialog.Item2"));
128 text.append("\n\n");
129 text.append(Dictionary.get("AboutDialog.Item3"));
130 text.append("\n\n");
131 text.append("*****" + Dictionary.get("AboutDialog.Thanks") + "*****");
132 text.append("\n\n");
133 text.append(Dictionary.get("AboutDialog.Item4"));
134 text.append("\n\n");
135 text.append(Dictionary.get("AboutDialog.Item5"));
136 text.append("\n\n");
137 text.append(Dictionary.get("AboutDialog.Item6"));
138 text.append("\n\n");
139 text.append(Dictionary.get("AboutDialog.Item7"));
140 text.append("\n\n");
141 text.append(Dictionary.get("AboutDialog.Item8"));
142 text.append("\n\n");
143 text.append(Dictionary.get("AboutDialog.Item9"));
144 text.append("\n\n");
145 text.setCaretPosition(0);
146
147 // Show
148 Rectangle frame_bounds = parent.getBounds();
149 setLocation(frame_bounds.x + (frame_bounds.width - SIZE.width) / 2, frame_bounds.y + (frame_bounds.height - SIZE.height) / 2);
150 setVisible(true);
151 }
152 /** Listens for actions upon the close button, and when detected closes the dialog. */
153 private class CloseButtonListener
154 implements ActionListener {
155 /** Called whenever an action occurs on the close button, thus asking the dialog to close.
156 * @param event an ActionEvent containing information about the button press
157 */
158 public void actionPerformed(ActionEvent event) {
159 self.setVisible(false);
160 self.dispose();
161 }
162 }
163}
Note: See TracBrowser for help on using the repository browser.