View Javadoc

1   /*
2    *   Magic-Project is a turn based strategy simulator
3    *   Copyright (C) 2003-2007 Fabrice Daugan
4    *
5    *   This program is free software; you can redistribute it and/or modify it 
6    * under the terms of the GNU General Public License as published by the Free 
7    * Software Foundation; either version 2 of the License, or (at your option) any
8    * later version.
9    *
10   *   This program is distributed in the hope that it will be useful, but WITHOUT 
11   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
13   * details.
14   *
15   *   You should have received a copy of the GNU General Public License along  
16   * with this program; if not, write to the Free Software Foundation, Inc., 
17   * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  package net.sf.magicproject.ui.wizard;
20  
21  import java.io.InputStream;
22  
23  import javax.swing.JFrame;
24  import javax.swing.JScrollPane;
25  import javax.swing.JTextArea;
26  import javax.swing.ScrollPaneConstants;
27  
28  import net.sf.magicproject.deckbuilder.MdbLoader;
29  import net.sf.magicproject.tools.MToolKit;
30  import net.sf.magicproject.ui.i18n.LanguageManager;
31  
32  import org.apache.commons.io.IOUtils;
33  
34  /***
35   * AboutMdb.java Created on 16 févr. 2004
36   * 
37   * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
38   * @since 0.1
39   */
40  public class AboutMdb extends Ok {
41  
42  	/***
43  	 * Creates a new instance of AboutMdb <br>
44  	 * 
45  	 * @param parent
46  	 */
47  	public AboutMdb(JFrame parent) {
48  		super(LanguageManager.getString("about.tbs"), "<html><b>"
49  				+ LanguageManager.getString("tbsname") + ": </b>"
50  				+ MdbLoader.tbsFullName + "<br><b>"
51  				+ LanguageManager.getString("author") + ": </b>" + MdbLoader.author
52  				+ "<br><b>" + LanguageManager.getString("info") + ": </b>"
53  				+ MdbLoader.moreInfo + "<br><b>" + LanguageManager.getString("version")
54  				+ ": </b>" + MdbLoader.version, "mp64.gif", LanguageManager
55  				.getString("close"), 420, 320);
56  		JTextArea disclaimer = new JTextArea();
57  		disclaimer.setEditable(false);
58  		disclaimer.setLineWrap(true);
59  		disclaimer.setWrapStyleWord(true);
60  		disclaimer.setAutoscrolls(true);
61  		// Then try and read it locally
62  		final InputStream inGPL = MToolKit.getResourceAsStream(MToolKit.mdbFile);
63  		if (inGPL != null) {
64  			disclaimer.setText(MdbLoader.disclaimer.trim().replaceAll("\t", "")
65  					.replaceAll("\n", ""));
66  			IOUtils.closeQuietly(inGPL);
67  		}
68  		JScrollPane disclaimerSPanel = new JScrollPane();
69  		disclaimerSPanel
70  				.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
71  		MToolKit.addOverlay(disclaimerSPanel);
72  		disclaimerSPanel.setViewportView(disclaimer);
73  		gameParamPanel.add(disclaimerSPanel);
74  		setLocation((getToolkit().getScreenSize().width - 420) / 2, (getToolkit()
75  				.getScreenSize().height - 320) / 2);
76  	}
77  
78  }