1 /*
2 * NeonZip - archive tool
3 * Copyright (C) 2001 Peter Ivanov
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 *
20 * @author Peter Ivanov
21 * <a href=mailto:peterivanov@europe.com>peterivanov@europe.com</a>,
22 * <br>Copyright (c) 2001 Peter K. Ivanov.
23 *
24 * @version (January 02 2002)
25 */
26
27 package net.sourceforge.neonzip;
28
29 import javax.swing;
30 import javax.swing.border;
31 import javax.swing.text.Caret;
32 import java.awt.event;
33 import java.awt;
34
35 public final class LogDialog extends JDialog {
36
37 private JTextArea fOutput;
38
39 public LogDialog(JFrame aOwner, boolean aModal) {
40 super(aOwner, aModal);
41 initComponents();
42 pack();
43 //setSize(400, 200);
44 Utils.centerWindow(this);
45 }
46
47
48
49 private void initComponents() {
50 setTitle(Main.fResources.getString("key.title.log_output"));
51
52 JPanel root = new JPanel(new BorderLayout());
53 root.setBorder(new EmptyBorder(5, 5, 5, 5));
54 setContentPane(root);
55
56 JPanel panelText = new JPanel();
57 fOutput = new JTextArea();
58 fOutput.setRows(15);
59 fOutput.setColumns(50);
60 fOutput.setEditable(false);
61 JScrollPane scroll = new JScrollPane( fOutput,
62 ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
63 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
64 panelText.add(scroll);
65 root.add(panelText, "Center");
66
67 JPanel panelButtons = new JPanel();
68 JButton btnOK = new JButton(new OKAction());
69 panelButtons.add(btnOK);
70
71 root.add(panelButtons, "South");
72 }
73
74
75
76 /**
77 * Show given text to the output text area.
78 */
79 public void setText(String aOutputText) {
80 fOutput.setText(aOutputText);
81 fOutput.setCaretPosition(0);
82 }
83
84
85
86 public void show() {
87 super.show();
88 fOutput.setCaretPosition(0);
89 }
90
91
92
93 private final class OKAction extends AbstractAction {
94 OKAction() {
95 super(Main.fResources.getString("key.button.ok"));
96 }
97
98 public void actionPerformed(ActionEvent e) {
99 dispose();
100 }
101 }
102
103
104
105 }