1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.ui.wizard;
20
21 import java.awt.Dimension;
22 import java.awt.FlowLayout;
23 import java.awt.Font;
24 import java.io.BufferedReader;
25 import java.io.IOException;
26 import java.io.InputStreamReader;
27
28 import javax.swing.BoxLayout;
29 import javax.swing.JFrame;
30 import javax.swing.JLabel;
31 import javax.swing.JPanel;
32 import javax.swing.JScrollPane;
33 import javax.swing.JTextArea;
34 import javax.swing.ScrollPaneConstants;
35 import javax.swing.SwingConstants;
36
37 import net.sf.magicproject.token.IdConst;
38 import net.sf.magicproject.tools.MToolKit;
39 import net.sf.magicproject.ui.UIHelper;
40 import net.sf.magicproject.ui.component.JLink;
41 import net.sf.magicproject.ui.i18n.LanguageManager;
42
43 import org.apache.commons.io.IOUtils;
44
45 /***
46 * @author Fabrice Daugan
47 * @since 0.53
48 * @since 0.54 MP logo added
49 */
50 public class About extends Ok {
51
52 /***
53 * Creates a new instance of About <br>
54 *
55 * @param parent
56 */
57 public About(JFrame parent) {
58 super(LanguageManager.getString("wiz_about.title"), LanguageManager
59 .getString("wiz_about.description"), "mp64.gif", LanguageManager
60 .getString("close"), 420, 620);
61 JPanel thanksPanel = new JPanel();
62
63 thanksPanel = new JPanel();
64 thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
65 thanksPanel.setMaximumSize(new Dimension(32767, 26));
66 thanksPanel.setOpaque(false);
67 JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : ");
68 jLabel5.setFont(MToolKit.defaultFont);
69 jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
70 jLabel5.setMaximumSize(new Dimension(100, 16));
71 jLabel5.setMinimumSize(new Dimension(100, 16));
72 jLabel5.setPreferredSize(new Dimension(100, 16));
73 thanksPanel.add(jLabel5);
74 jLabel5 = new JLabel(IdConst.VERSION);
75 thanksPanel.add(jLabel5);
76 gameParamPanel.add(thanksPanel);
77
78 thanksPanel = new JPanel();
79 thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
80 thanksPanel.setOpaque(false);
81 JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING));
82 thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
83 thanksPanelLeft.setMaximumSize(new Dimension(100, 2000));
84 thanksPanelLeft.setMinimumSize(new Dimension(100, 16));
85 jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : ");
86 jLabel5.setFont(MToolKit.defaultFont);
87 jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
88 jLabel5.setMaximumSize(new Dimension(100, 16));
89 jLabel5.setMinimumSize(new Dimension(100, 16));
90 jLabel5.setPreferredSize(new Dimension(100, 16));
91 thanksPanelLeft.add(jLabel5);
92 thanksPanel.add(thanksPanelLeft);
93 thanksPanelLeft = new JPanel();
94 thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
95 StringBuilder contributors = new StringBuilder();
96 addContributor(contributors, "Fabrice Daugan", "developper", "france");
97 addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia");
98 addContributor(contributors, "nico100", "graphist", "france");
99 addContributor(contributors, "seingalt_tm", "graphist", "france");
100 addContributor(contributors, "surtur2", "tester", null);
101 addContributor(contributors, "Jan Blaha", "developper", "cz");
102 addContributor(contributors, "Tureba", "developper", "brazil");
103 addContributor(contributors, "hakvf", "tester", "france");
104 addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper",
105 "italian");
106 jLabel5 = new JLabel(contributors.toString());
107 jLabel5.setFont(MToolKit.defaultFont);
108 jLabel5.setHorizontalAlignment(SwingConstants.LEFT);
109 thanksPanelLeft.add(jLabel5);
110 jLabel5 = new JLink("http://obsidiurne.free.fr",
111 "morgil has designed the splash screen");
112 jLabel5.setFont(MToolKit.defaultFont);
113 thanksPanelLeft.add(jLabel5);
114 thanksPanel.add(thanksPanelLeft);
115
116 gameParamPanel.add(thanksPanel);
117
118 thanksPanel = new JPanel();
119 thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
120 thanksPanel.setMaximumSize(new Dimension(32767, 26));
121 thanksPanel.setOpaque(false);
122 JLabel blanklbl = new JLabel();
123 blanklbl.setHorizontalAlignment(SwingConstants.RIGHT);
124 blanklbl.setMaximumSize(new Dimension(100, 16));
125 blanklbl.setMinimumSize(new Dimension(100, 16));
126 blanklbl.setPreferredSize(new Dimension(100, 16));
127 thanksPanel.add(blanklbl);
128
129 jLabel5 = new JLink(
130 "http://sourceforge.net/tracker/?func=add&group_id=92519&atid=601043",
131 LanguageManager.getString("joindev"));
132 jLabel5.setFont(MToolKit.defaultFont);
133 thanksPanel.add(jLabel5);
134 gameParamPanel.add(thanksPanel);
135
136 thanksPanel = new JPanel();
137 thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
138 thanksPanel.setOpaque(false);
139 jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : ");
140 jLabel5.setFont(MToolKit.defaultFont);
141 jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
142 jLabel5.setMaximumSize(new Dimension(100, 16));
143 jLabel5.setMinimumSize(new Dimension(100, 16));
144 jLabel5.setPreferredSize(new Dimension(100, 16));
145 thanksPanel.add(jLabel5);
146 jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE);
147 jLabel5.setFont(MToolKit.defaultFont);
148 thanksPanel.add(jLabel5);
149 gameParamPanel.add(thanksPanel);
150
151
152 thanksPanel = new JPanel();
153 thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
154 thanksPanel.setOpaque(false);
155 jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : ");
156 jLabel5.setFont(MToolKit.defaultFont);
157 jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
158 jLabel5.setMaximumSize(new Dimension(100, 16));
159 jLabel5.setMinimumSize(new Dimension(100, 16));
160 jLabel5.setPreferredSize(new Dimension(100, 16));
161 thanksPanel.add(jLabel5);
162 jLabel5 = new JLink("http://www.magic-project.fr.st", UIHelper
163 .getIcon("mpfrsml.gif"), SwingConstants.LEFT);
164 jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip"));
165 thanksPanel.add(jLabel5);
166 jLabel5 = new JLabel();
167 jLabel5.setMaximumSize(new Dimension(1000, 16));
168 thanksPanel.add(jLabel5);
169 gameParamPanel.add(thanksPanel);
170
171 JTextArea disclaimer = new JTextArea();
172 disclaimer.setEditable(false);
173 disclaimer.setLineWrap(true);
174 disclaimer.setWrapStyleWord(true);
175 disclaimer.setAutoscrolls(true);
176 disclaimer.setTabSize(2);
177 disclaimer.setFont(new Font("Arial", 0, 10));
178
179 BufferedReader inGPL = null;
180 try {
181 inGPL = new BufferedReader(new InputStreamReader(MToolKit
182 .getResourceAsStream(IdConst.FILE_LICENSE)));
183 disclaimer.read(inGPL, "");
184 } catch (IOException e) {
185 e.printStackTrace();
186 } finally {
187 IOUtils.closeQuietly(inGPL);
188 }
189 JScrollPane disclaimerSPanel = new JScrollPane();
190 disclaimerSPanel
191 .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
192 MToolKit.addOverlay(disclaimerSPanel);
193 disclaimerSPanel.setViewportView(disclaimer);
194 gameParamPanel.add(disclaimerSPanel);
195 }
196
197 /***
198 * Add a contributor to the given buffer.
199 *
200 * @param contributors
201 * the current buffer.
202 * @param name
203 * the nickname/real name.
204 * @param role
205 * the contributor role.
206 * @param country
207 * the country key.
208 */
209 private void addContributor(StringBuilder contributors, String name,
210 String role, String country) {
211 if (contributors.length() == 0) {
212 contributors.append("<html>");
213 } else {
214 contributors.append("<br>");
215 }
216 contributors.append("<b>");
217 contributors.append(name);
218 contributors.append("</b> ");
219 contributors.append(LanguageManager.getString(role));
220 if (country != null && country.length() > 0) {
221 contributors.append(" <i>(");
222 contributors.append(LanguageManager.getString(country));
223 contributors.append(")</i>");
224 }
225 }
226
227 }