source: trunk/gli/src/org/greenstone/gatherer/gui/SimpleResultDialog.java@ 12119

Last change on this file since 12119 was 12119, checked in by kjdon, 18 years ago

Changed text handling to use Dictionary.get rather than Dictionary.setText or Dictionary.registerBoth etc. also removed mnemonics cos they suck for other languages

  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 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 java.io.*;
42import java.util.ArrayList;
43import javax.swing.*;
44import javax.swing.event.*;
45
46import org.greenstone.gatherer.Gatherer;
47import org.greenstone.gatherer.Dictionary;
48
49public class SimpleResultDialog
50 extends ModalDialog {
51
52 private Dimension size = new Dimension(600,300);
53 private SimpleResultDialog self;
54
55 public SimpleResultDialog(String title, String label, String results) {
56 super(Gatherer.g_man, title, true);
57 this.self = this;
58
59 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
60 setSize(size);
61
62 JPanel content_pane = (JPanel) getContentPane();
63 JLabel result_label = new JLabel(label);
64
65 JPanel button_pane = new JPanel();
66 JButton close_button = new GLIButton(Dictionary.get("General.Close"));
67 close_button.addActionListener(new CloseButtonListener());
68
69 JPanel output_pane = new JPanel();
70 JLabel output_label = new JLabel(Dictionary.get("General.Review_Output"));
71
72 JTextArea output_textarea = new JTextArea(results);
73 output_textarea.setCaretPosition(0);
74 output_textarea.setEditable(false);
75 output_textarea.setLineWrap(true);
76 output_textarea.setWrapStyleWord(true);
77
78 button_pane.setLayout(new BorderLayout());
79 button_pane.add(close_button, BorderLayout.EAST);
80
81 output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
82 output_pane.setLayout(new BorderLayout());
83 output_pane.add(output_label, BorderLayout.NORTH);
84 output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
85
86 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
87 content_pane.setLayout(new BorderLayout());
88 content_pane.add(result_label, BorderLayout.NORTH);
89 content_pane.add(output_pane, BorderLayout.CENTER);
90 content_pane.add(button_pane, BorderLayout.SOUTH);
91
92 // Position
93 Rectangle frame_bounds = Gatherer.g_man.getBounds();
94 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
95 }
96
97 private class CloseButtonListener
98 implements ActionListener {
99 public void actionPerformed(ActionEvent event) {
100 self.setVisible(false);
101 }
102 }
103}
Note: See TracBrowser for help on using the repository browser.