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

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

Fixed tabbing.

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