aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-02-27 14:53:05 +0100
committerPacien TRAN-GIRARD2014-02-27 14:53:05 +0100
commitbd639caa0bbf010c415d197b93d0f30a6cb8f1e4 (patch)
treeeafea054e5ad11d826b0d64fc46b5352f8f0098a /src
parentbe54bc04446494c5c87a020a7e51e51a76613551 (diff)
downloadesieequest-bd639caa0bbf010c415d197b93d0f30a6cb8f1e4.tar.gz
Code refactoring to match MVC
Diffstat (limited to 'src')
-rw-r--r--src/com/wordpress/tipsforjava/swing/StretchIcon.java372
-rw-r--r--src/esieequest/Command.java70
-rw-r--r--src/esieequest/CommandWords.java45
-rw-r--r--src/esieequest/Game.java29
-rw-r--r--src/esieequest/GameEngine.java271
-rwxr-xr-xsrc/esieequest/Main.java44
-rw-r--r--src/esieequest/Parser.java60
-rw-r--r--src/esieequest/UserInterface.java151
-rw-r--r--src/esieequest/controller/GameEngine.java51
-rw-r--r--src/esieequest/controller/Interpreter.java68
-rw-r--r--src/esieequest/controller/Parser.java31
-rw-r--r--src/esieequest/controller/Performer.java73
-rw-r--r--src/esieequest/controller/package-info.java8
-rw-r--r--src/esieequest/model/Game.java223
-rw-r--r--src/esieequest/model/Room.java (renamed from src/esieequest/Room.java)32
-rw-r--r--src/esieequest/model/command/Command.java35
-rw-r--r--src/esieequest/model/command/CommandWord.java43
-rw-r--r--src/esieequest/model/command/package-info.java8
-rw-r--r--src/esieequest/model/package-info.java8
-rw-r--r--src/esieequest/package-info.java10
-rw-r--r--src/esieequest/view/Applet.java27
-rw-r--r--src/esieequest/view/Console.java61
-rw-r--r--src/esieequest/view/UserInterface.java247
-rw-r--r--src/esieequest/view/View.java23
-rw-r--r--src/esieequest/view/Window.java35
-rw-r--r--src/esieequest/view/package-info.java8
-rw-r--r--src/net/homelinux/nikiroo/utils/gui/JBackgroundPanel.java308
27 files changed, 1690 insertions, 651 deletions
diff --git a/src/com/wordpress/tipsforjava/swing/StretchIcon.java b/src/com/wordpress/tipsforjava/swing/StretchIcon.java
new file mode 100644
index 0000000..667f1cd
--- /dev/null
+++ b/src/com/wordpress/tipsforjava/swing/StretchIcon.java
@@ -0,0 +1,372 @@
1/**
2 * @(#)StretchIcon.java 1.0 03/27/12
3 */
4package com.wordpress.tipsforjava.swing;
5
6import java.awt.Component;
7import java.awt.Container;
8import java.awt.Graphics;
9import java.awt.Image;
10import java.awt.Insets;
11import java.awt.image.ImageObserver;
12import java.net.URL;
13import javax.swing.ImageIcon;
14
15/**
16 * An <CODE>Icon</CODE> that scales its image to fill the component area,
17 * excluding any border or insets, optionally maintaining the image's aspect
18 * ratio by padding and centering the scaled image horizontally or vertically.
19 * <P>
20 * The class is a drop-in replacement for <CODE>ImageIcon</CODE>.
21 * <P>
22 * As the size of the Icon is determined by the size of the component in which
23 * it is displayed, <CODE>StretchIcon</CODE> must only be used in conjunction
24 * with a component and layout that does not depend on the size of the
25 * component's Icon.
26 *
27 * @version 1.0 03/22/12
28 * @author Darryl
29 */
30public class StretchIcon extends ImageIcon {
31
32 /**
33 * Determines whether the aspect ratio of the image is maintained. Set to
34 * <code>false</code> to distort the image to fill the component.
35 */
36 protected boolean proportionate = true;
37
38 /**
39 * Creates a <CODE>StretchIcon</CODE> from an array of bytes.
40 *
41 * @param imageData
42 * an array of pixels in an image format supported by the AWT
43 * Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
44 *
45 * @see ImageIcon#ImageIcon(byte[])
46 */
47 public StretchIcon(byte[] imageData) {
48 super(imageData);
49 }
50
51 /**
52 * Creates a <CODE>StretchIcon</CODE> from an array of bytes with the
53 * specified behavior.
54 *
55 * @param imageData
56 * an array of pixels in an image format supported by the AWT
57 * Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
58 * @param proportionate
59 * <code>true</code> to retain the image's aspect ratio,
60 * <code>false</code> to allow distortion of the image to fill
61 * the component.
62 *
63 * @see ImageIcon#ImageIcon(byte[])
64 */
65 public StretchIcon(byte[] imageData, boolean proportionate) {
66 super(imageData);
67 this.proportionate = proportionate;
68 }
69
70 /**
71 * Creates a <CODE>StretchIcon</CODE> from an array of bytes.
72 *
73 * @param imageData
74 * an array of pixels in an image format supported by the AWT
75 * Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
76 * @param description
77 * a brief textual description of the image
78 *
79 * @see ImageIcon#ImageIcon(byte[], java.lang.String)
80 */
81 public StretchIcon(byte[] imageData, String description) {
82 super(imageData, description);
83 }
84
85 /**
86 * Creates a <CODE>StretchIcon</CODE> from an array of bytes with the
87 * specified behavior.
88 *
89 * @see ImageIcon#ImageIcon(byte[])
90 * @param imageData
91 * an array of pixels in an image format supported by the AWT
92 * Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
93 * @param description
94 * a brief textual description of the image
95 * @param proportionate
96 * <code>true</code> to retain the image's aspect ratio,
97 * <code>false</code> to allow distortion of the image to fill
98 * the component.
99 *
100 * @see ImageIcon#ImageIcon(byte[], java.lang.String)
101 */
102 public StretchIcon(byte[] imageData, String description, boolean proportionate) {
103 super(imageData, description);
104 this.proportionate = proportionate;
105 }
106
107 /**
108 * Creates a StretchIcon from the image.
109 *
110 * @param image
111 * the image
112 *
113 * @see ImageIcon#ImageIcon(java.awt.Image)
114 */
115 public StretchIcon(Image image) {
116 super(image);
117 }
118
119 /**
120 * Creates a StretchIcon from the image with the specifiec behavior.
121 *
122 * @param image
123 * the image
124 * @param proportionate
125 * <code>true</code> to retain the image's aspect ratio,
126 * <code>false</code> to allow distortion of the image to fill
127 * the component.
128 *
129 * @see ImageIcon#ImageIcon(java.awt.Image)
130 */
131 public StretchIcon(Image image, boolean proportionate) {
132 super(image);
133 this.proportionate = proportionate;
134 }
135
136 /**
137 * Creates a StretchIcon from the image.
138 *
139 * @param image
140 * the image
141 * @param description
142 * a brief textual description of the image
143 *
144 * @see ImageIcon#ImageIcon(java.awt.Image, java.lang.String)
145 */
146 public StretchIcon(Image image, String description) {
147 super(image, description);
148 }
149
150 /**
151 * Creates a StretchIcon from the image with the specified behavior.
152 *
153 * @param image
154 * the image
155 * @param description
156 * a brief textual description of the image
157 * @param proportionate
158 * <code>true</code> to retain the image's aspect ratio,
159 * <code>false</code> to allow distortion of the image to fill
160 * the component.
161 *
162 * @see ImageIcon#ImageIcon(java.awt.Image, java.lang.String)
163 */
164 public StretchIcon(Image image, String description, boolean proportionate) {
165 super(image, description);
166 this.proportionate = proportionate;
167 }
168
169 /**
170 * Creates a StretchIcon from the specified file.
171 *
172 * @param filename