View Javadoc

1   /**
2    * Copyright (C) 2007 Joern Krueger surething@users.sourceforge.net
3    * 
4    * This program is free software; you can redistribute
5    * it and/or modify it under the terms of the GNU General
6    * Public License version 2 as published by the Free Software
7    * Foundation.
8    *
9    * This program is distributed in the hope that it will be
10   * useful, but WITHOUT ANY WARRANTY; without even the implied
11   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12   * PURPOSE.  See the GNU General Public License for more
13   * details.
14   *
15   * You should have received a copy of the GNU General Public
16   * License along with this program; if not, write to the
17   * Free Software Foundation, Inc., 59 Temple Place,
18   * Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.surething.lda.ui;
21  
22  import java.awt.Dimension;
23  import java.awt.Frame;
24  import java.awt.event.WindowAdapter;
25  import java.awt.event.WindowEvent;
26  
27  import javax.swing.JDialog;
28  import javax.swing.JEditorPane;
29  import javax.swing.JScrollPane;
30  
31  import de.surething.lda.resources.Messages;
32  
33  @SuppressWarnings("serial")
34  public class AboutDialog extends JDialog {
35  
36      public AboutDialog(Frame owner, String text) {
37          super(owner, Messages.getString("AboutDialog.Title"), true);
38  
39          addWindowListener(new WindowAdapter() {
40              public void windowClosing(WindowEvent e) {
41                  dispose();
42              }
43          });
44  
45          JEditorPane textfield = new JEditorPane("text/html", text);
46          textfield.setPreferredSize(new Dimension(320, 200));
47          textfield.setEditable(false);
48          textfield.setCaretPosition(0);
49  
50          JScrollPane scroller = new JScrollPane(textfield);
51          add(scroller);
52  
53          pack();
54          setLocationRelativeTo(owner);
55          setVisible(true);
56      }
57  }