1 /*
2 * Fsgrep is a simple Java application which allows a user to
3 * search all files in a directory structure for lines matching
4 * a given pattern. Its functionality is a combination of the
5 * Unix 'find' and 'grep' utilities.
6 * Visit [http://fsgrep.sourceforge.net/] for more information.
7 *
8 * Copyright (C) 2003-2006 Murali Krishnan [murali_ca_us@users.sourceforge.net]
9 *
10 * Fsgrep is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
13 *
14 * Fsgrep is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Fsgrep (see the file named LICENSE.txt); if not, write
21 * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22 * Boston, MA 02111-1307 USA
23 */
24
25 package mk.fsgrep.gui;
26
27
28 import java.awt.*;
29
30 import javax.swing.*;
31
32
33 /***
34 *
35 *
36 * @author Murali Krishnan
37 *
38 */
39 public class InfoDialog {
40
41 //------------------------------------------------------------
42 //- Class Variables
43
44
45
46 //------------------------------------------------------------
47 //- Class Functions
48
49
50
51 //------------------------------------------------------------
52 //- Instance Variables
53
54 private String _content = "";
55
56
57 //------------------------------------------------------------
58 //- Constructors
59
60 protected InfoDialog(Component owner, String content) {
61 this(owner, "Fsgrep Info", content);
62 }
63
64
65 protected InfoDialog(Component owner, String title, String content) {
66 _content = content;
67
68 JOptionPane.showMessageDialog(owner,
69 createMainPanel(),
70 title,
71 JOptionPane.INFORMATION_MESSAGE);
72 }
73
74
75 //------------------------------------------------------------
76 //- Accessors
77
78 protected String getContent() {return _content;}
79
80
81 //------------------------------------------------------------
82 //- Settors
83
84
85
86 //------------------------------------------------------------
87 //- Private/Protected Utility Functions
88
89 protected JPanel createMainPanel() {
90 JPanel result = new JPanel(new BorderLayout());
91
92 JScrollPane scrollPane = new JScrollPane();
93 {
94 JTextArea textarea = new JTextArea(getContent(), 20, 50);
95 textarea.setEditable(false);
96 textarea.setWrapStyleWord(true);
97 textarea.setCaretPosition(0);
98
99 scrollPane.setViewportView(textarea);
100 }
101
102 result.add(BorderLayout.CENTER, scrollPane);
103
104 return result;
105 }
106
107
108 //------------------------------------------------------------
109 //- Public Interface Functions
110
111
112
113 //------------------------------------------------------------
114 //- Class Interface Functions
115
116
117
118 //------------------------------------------------------------
119 //- Inner Classes
120
121
122
123 //------------------------------------------------------------
124 //- Main
125
126
127
128 }