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

Last change on this file since 5589 was 5589, checked in by mdewsnip, 21 years ago

Nearly finished adding tooltips (and thank goodness for that).

  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.gui;
38
39import java.awt.*;
40import java.awt.event.*;
41import javax.swing.*;
42import org.greenstone.gatherer.Dictionary;
43import org.greenstone.gatherer.Gatherer;
44import org.greenstone.gatherer.util.Utility;
45
46/**
47 * @author John Thompson, Greenstone Digital Library, University of Waikato
48 * @version 2.3c
49 */
50
51// RICOH SOURCE CODE PUBLIC LICENSE - http://www.risource.org/RPL/RPL-1.0A.shtml
52public class AboutDialog
53 extends JDialog {
54 private AboutDialog self;
55 private JButton close_button;
56
57 static final private Dimension SIZE = new Dimension(600, 325);
58 static final private int ICON_SIZE = 65;
59
60 public AboutDialog(JFrame parent) {
61 super(parent, Dictionary.newget("AboutDialog.Title"), true);
62 this.self = this;
63 setSize(SIZE);
64
65 JPanel content_pane = (JPanel) getContentPane();
66 JPanel upper_pane = new JPanel();
67 ImageIcon icon = Utility.getImage("medgath.gif");
68 ImageIcon scaled_icon = new ImageIcon(icon.getImage().getScaledInstance(ICON_SIZE, ICON_SIZE, Image.SCALE_DEFAULT));
69 JLabel icon_label = new JLabel(scaled_icon);
70 JPanel title_pane = new JPanel();
71 JLabel title_one_label = new JLabel();
72 Dictionary.setText(title_one_label, "AboutDialog.Title_One");
73 JLabel title_two_label = new JLabel(Utility.PROGRAM_NAME + " " + Utility.PROGRAM_VERSION + " " + Dictionary.newget("AboutDialog.Date"));
74 JLabel title_three_label = new JLabel();
75 Dictionary.setText(title_three_label, "AboutDialog.Title_Two");
76 JLabel copyright_label = new JLabel();
77 Dictionary.setText(copyright_label, "AboutDialog.Copyright");
78
79 JTextArea text = new JTextArea();
80 text.setLineWrap(true);
81 text.setWrapStyleWord(true);
82
83 JPanel button_pane = new JPanel();
84 close_button = new JButton();
85 Dictionary.setBoth(close_button, "General.Close", "General.Close_Tooltip");
86
87 // Connection
88 close_button.addActionListener(new CloseButtonListener());
89
90 // Layout
91 icon_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,10));
92
93 title_pane.setLayout(new GridLayout(4,1,0,2));
94 title_pane.add(title_one_label);
95 title_pane.add(title_two_label);
96 title_pane.add(title_three_label);
97 title_pane.add(copyright_label);
98
99 upper_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
100 upper_pane.setLayout(new BorderLayout());
101 upper_pane.add(icon_label, BorderLayout.WEST);
102 upper_pane.add(title_pane, BorderLayout.CENTER);
103
104 button_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
105 button_pane.setLayout(new BorderLayout());
106 button_pane.add(close_button, BorderLayout.EAST);
107
108 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
109 content_pane.setLayout(new BorderLayout());
110 content_pane.add(upper_pane, BorderLayout.NORTH);
111 content_pane.add(new JScrollPane(text), BorderLayout.CENTER);
112 content_pane.add(button_pane, BorderLayout.SOUTH);
113
114 // Build text content
115 text.append(Dictionary.newget("AboutDialog.Java_Req"));
116 text.append("\n");
117 text.append(Dictionary.newget("AboutDialog.Java_Req_One"));
118 text.append("\n");
119 text.append(Dictionary.newget("AboutDialog.Java_Req_Two"));
120 text.append("\n\n");
121 text.append("*****" + Dictionary.newget("AboutDialog.Acknowledgement") + "*****");
122 text.append("\n\n");
123 text.append(Dictionary.newget("AboutDialog.Item0"));
124 text.append("\n\n");
125 text.append(Dictionary.newget("AboutDialog.Item1"));
126 text.append("\n\n");
127 text.append(Dictionary.newget("AboutDialog.Item2"));
128 text.append("\n\n");
129 text.append(Dictionary.newget("AboutDialog.Item3"));
130 text.append("\n\n");
131 text.append("*****" + Dictionary.newget("AboutDialog.Thanks") + "*****");
132 text.append("\n\n");
133 text.append(Dictionary.newget("AboutDialog.Item4"));
134 text.append("\n\n");
135 text.append(Dictionary.newget("AboutDialog.Item5"));
136 text.append("\n\n");
137 text.append(Dictionary.newget("AboutDialog.Item6"));
138 text.append("\n\n");
139 text.append(Dictionary.newget("AboutDialog.Item7"));
140 text.append("\n\n");
141 text.append(Dictionary.newget("AboutDialog.Item8"));
142 text.setCaretPosition(0);
143
144 // Show
145 Rectangle frame_bounds = parent.getBounds();
146 setLocation(frame_bounds.x + (frame_bounds.width - SIZE.width) / 2, frame_bounds.y + (frame_bounds.height - SIZE.height) / 2);
147 show();
148 }
149
150 private class CloseButtonListener
151 implements ActionListener {
152 public void actionPerformed(ActionEvent event) {
153 self.hide();
154 self.dispose();
155 }
156 }
157}
Note: See TracBrowser for help on using the repository browser.