1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.sf.magicproject.deckbuilder;
22
23 import java.io.BufferedReader;
24 import java.io.FileReader;
25 import java.io.IOException;
26
27 import javax.swing.JFrame;
28 import javax.swing.JScrollPane;
29 import javax.swing.JTextArea;
30
31 import net.sf.magicproject.tools.MToolKit;
32 import net.sf.magicproject.ui.i18n.LanguageManager;
33 import net.sf.magicproject.ui.wizard.Ok;
34
35 import org.apache.commons.io.IOUtils;
36
37 /***
38 * @author <a href="mailto:goldeneyemdk@users.sourceforge.net">Sebastien Genete
39 * </a>
40 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
41 * @since 0.83
42 */
43 public class DeckRules extends Ok {
44
45 /***
46 * Create a new instance of DeckRules
47 *
48 * @param parent
49 */
50 public DeckRules(JFrame parent) {
51 super(LanguageManager.getString("jdeckrules", MdbLoader.tbsFullName),
52 LanguageManager.getString("jdeckrules.tooltip", MdbLoader.tbsFullName),
53 "wiz_library_wiz.png", LanguageManager.getString("close"), 490, 300);
54
55 final JTextArea textRules = new JTextArea();
56 textRules.setEditable(false);
57 textRules.setLineWrap(true);
58 textRules.setWrapStyleWord(true);
59 textRules.setAutoscrolls(true);
60 textRules.setTabSize(2);
61 textRules.setText("No defined rules");
62 BufferedReader inGPL = null;
63 try {
64 inGPL = new BufferedReader(new FileReader(MToolKit
65 .getTbsFile("decks/DECK_CONSTRAINTS-"
66 + LanguageManager.getLanguage().getLocale() + "-lang.info")));
67 textRules.read(inGPL, "Deck constraints");
68 } catch (IOException e) {
69
70 } finally {
71 IOUtils.closeQuietly(inGPL);
72 }
73
74 final JScrollPane scrollingArea = new JScrollPane(textRules);
75 gameParamPanel.add(scrollingArea);
76 pack();
77 }
78 }