diff options
author | Pacien TRAN-GIRARD | 2014-03-06 16:55:48 +0000 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-03-06 16:55:48 +0000 |
commit | 44260a59df288b2c1225ec0a70cb02c215844f69 (patch) | |
tree | 43f6798170b1b8fa5976e3cee25903668c9c1ad6 /src/esieequest/view/app/UserInterface.java | |
parent | c1edc7c5edc0055b7f2d5d57f907e4a9696cb20a (diff) | |
parent | 017d326b42ed4e77b26b0f2b4a865c9b46bb3004 (diff) | |
download | esieequest-44260a59df288b2c1225ec0a70cb02c215844f69.tar.gz |
Merge branch 'zuul-with-items-v1' into 'master'
Zuul With Items V1
Diffstat (limited to 'src/esieequest/view/app/UserInterface.java')
-rw-r--r-- | src/esieequest/view/app/UserInterface.java | 345 |
1 files changed, 172 insertions, 173 deletions
diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java index 36b928e..4f87ef6 100644 --- a/src/esieequest/view/app/UserInterface.java +++ b/src/esieequest/view/app/UserInterface.java | |||
@@ -25,232 +25,231 @@ import java.awt.Font; | |||
25 | 25 | ||
26 | public abstract class UserInterface implements View, ActionListener { | 26 | public abstract class UserInterface implements View, ActionListener { |
27 | 27 | ||
28 | protected Game aGame; | 28 | protected Game game; |
29 | private GameEngine aGameEngine; | 29 | private GameEngine gameEngine; |
30 | 30 | ||
31 | private JPanel aLayout; | 31 | private JPanel layout; |
32 | 32 | ||
33 | private JTextPane aQuestTextPane; | 33 | private JTextPane questTextPane; |
34 | private JTextPane aInfoTextPane; | 34 | private JTextPane infoTextPane; |
35 | 35 | ||
36 | private JLabel aImageLabel; | 36 | private JLabel imageLabel; |
37 | 37 | ||
38 | private HashMap<String, JButton> aGameButtons; | 38 | private HashMap<String, JButton> gameButtons; |
39 | private HashMap<String, JButton> aControlButtons; | 39 | private HashMap<String, JButton> controlButtons; |
40 | private JTextField aInputField; | 40 | private JTextField inputField; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Create the panel. | 43 | * Create the panel. |
44 | */ | 44 | */ |
45 | public UserInterface() { | 45 | public UserInterface() { |
46 | this.buildUI(); | 46 | this.buildUI(); |
47 | this.aInputField.addActionListener(this); | 47 | this.inputField.addActionListener(this); |
48 | this.setControlsState(false); | 48 | this.setControlsState(false); |
49 | aInputField.setEnabled(true); | 49 | inputField.setEnabled(true); |
50 | } | 50 | } |
51 | 51 | ||
52 | private void buildUI() { | 52 | private void buildUI() { |
53 | this.aLayout = new JPanel(); | 53 | this.layout = new JPanel(); |
54 | this.aLayout.setLayout(new BorderLayout(0, 0)); | 54 | this.layout.setLayout(new BorderLayout(0, 0)); |
55 | 55 | ||
56 | JPanel vMenuPanel = new JPanel(); | 56 | JPanel menuPanel = new JPanel(); |
57 | this.aLayout.add(vMenuPanel, BorderLayout.NORTH); | 57 | this.layout.add(menuPanel, BorderLayout.NORTH); |
58 | vMenuPanel.setLayout(new BorderLayout(0, 0)); | 58 | menuPanel.setLayout(new BorderLayout(0, 0)); |
59 | 59 | ||
60 | JPanel vQuestPanel = new JPanel(); | 60 | JPanel questPanel = new JPanel(); |
61 | vMenuPanel.add(vQuestPanel, BorderLayout.CENTER); | 61 | menuPanel.add(questPanel, BorderLayout.CENTER); |
62 | 62 | ||
63 | this.aQuestTextPane = new JTextPane(); | 63 | this.questTextPane = new JTextPane(); |
64 | this.aQuestTextPane.setEditable(false); | 64 | this.questTextPane.setEditable(false); |
65 | this.aQuestTextPane.setText("ESIEEquest"); | 65 | this.questTextPane.setText("ESIEEquest"); |
66 | vQuestPanel.add(this.aQuestTextPane); | 66 | questPanel.add(this.questTextPane); |
67 | 67 | ||
68 | JPanel vGamePanel = new JPanel(); | 68 | JPanel gamePanel = new JPanel(); |
69 | vMenuPanel.add(vGamePanel, BorderLayout.WEST); | 69 | menuPanel.add(gamePanel, BorderLayout.WEST); |
70 | 70 | ||
71 | JButton vNewButton = new JButton("New"); | 71 | JButton newButton = new JButton("New"); |
72 | vNewButton.setToolTipText("New game"); | 72 | newButton.setToolTipText("New game"); |
73 | vGamePanel.add(vNewButton); | 73 | gamePanel.add(newButton); |
74 | 74 | ||
75 | JButton vSoundButton = new JButton("Sound"); | 75 | JButton soundButton = new JButton("Sound"); |
76 | vSoundButton.setToolTipText("Toggle sound"); | 76 | soundButton.setToolTipText("Toggle sound"); |
77 | vGamePanel.add(vSoundButton); | 77 | gamePanel.add(soundButton); |
78 | 78 | ||
79 | JPanel filePanel = new JPanel(); | 79 | JPanel filePanel = new JPanel(); |
80 | vMenuPanel.add(filePanel, BorderLayout.EAST); | 80 | menuPanel.add(filePanel, BorderLayout.EAST); |
81 | 81 | ||
82 | JButton vLoadButton = new JButton("Load"); | 82 | JButton loadButton = new JButton("Load"); |
83 | vLoadButton.setToolTipText("Load a game"); | 83 | loadButton.setToolTipText("Load a game"); |
84 | filePanel.add(vLoadButton); | 84 | filePanel.add(loadButton); |
85 | 85 | ||
86 | JButton vSaveButton = new JButton("Save"); | 86 | JButton saveButton = new JButton("Save"); |
87 | vSaveButton.setToolTipText("Save the current game"); | 87 | saveButton.setToolTipText("Save the current game"); |
88 | filePanel.add(vSaveButton); | 88 | filePanel.add(saveButton); |
89 | 89 | ||
90 | JPanel vImagePanel = new JPanel(); | 90 | JPanel imagePanel = new JPanel(); |
91 | aLayout.add(vImagePanel, BorderLayout.CENTER); | 91 | layout.add(imagePanel, BorderLayout.CENTER); |
92 | vImagePanel.setLayout(new BorderLayout(0, 0)); | 92 | imagePanel.setLayout(new BorderLayout(0, 0)); |
93 | 93 | ||
94 | this.aImageLabel = new JLabel(); | 94 | this.imageLabel = new JLabel(); |
95 | vImagePanel.add(this.aImageLabel); | 95 | imagePanel.add(this.imageLabel); |
96 | 96 | ||
97 | JPanel vUserPanel = new JPanel(); | 97 | JPanel userPanel = new JPanel(); |
98 | this.aLayout.add(vUserPanel, BorderLayout.SOUTH); | 98 | this.layout.add(userPanel, BorderLayout.SOUTH); |
99 | vUserPanel.setLayout(new BorderLayout(0, 0)); | 99 | userPanel.setLayout(new BorderLayout(0, 0)); |
100 | 100 | ||
101 | JPanel vDispPanel = new JPanel(); | 101 | JPanel dispPanel = new JPanel(); |
102 | vDispPanel.setBorder(new EmptyBorder(5, 5, 5, 0)); | 102 | dispPanel.setBorder(new EmptyBorder(5, 5, 5, 0)); |
103 | vUserPanel.add(vDispPanel, BorderLayout.CENTER); | 103 | userPanel.add(dispPanel, BorderLayout.CENTER); |
104 | vDispPanel.setLayout(new BorderLayout(0, 0)); | 104 | dispPanel.setLayout(new BorderLayout(0, 0)); |
105 | 105 | ||
106 | this.aInfoTextPane = new JTextPane(); | 106 | this.infoTextPane = new JTextPane(); |
107 | this.aInfoTextPane.setEditable(false); | 107 | this.infoTextPane.setEditable(false); |
108 | this.aInfoTextPane.setText("Welcome to ESIEEquest!"); | 108 | this.infoTextPane.setText("Welcome to ESIEEquest!"); |
109 | vDispPanel.add(this.aInfoTextPane); | 109 | dispPanel.add(this.infoTextPane); |
110 | 110 | ||
111 | aInputField = new JTextField(); | 111 | inputField = new JTextField(); |
112 | vDispPanel.add(aInputField, BorderLayout.SOUTH); | 112 | dispPanel.add(inputField, BorderLayout.SOUTH); |
113 | aInputField.setColumns(10); | 113 | inputField.setColumns(10); |
114 | 114 | ||
115 | JPanel vControlPanel = new JPanel(); | 115 | JPanel controlPanel = new JPanel(); |
116 | vControlPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); | 116 | controlPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); |
117 | vUserPanel.add(vControlPanel, BorderLayout.EAST); | 117 | userPanel.add(controlPanel, BorderLayout.EAST); |
118 | vControlPanel.setLayout(new BorderLayout(0, 0)); | 118 | controlPanel.setLayout(new BorderLayout(0, 0)); |
119 | 119 | ||
120 | JPanel vTopControlPanel = new JPanel(); | 120 | JPanel topControlPanel = new JPanel(); |
121 | vControlPanel.add(vTopControlPanel, BorderLayout.NORTH); | 121 | controlPanel.add(topControlPanel, BorderLayout.NORTH); |
122 | vTopControlPanel.setLayout(new BorderLayout(0, 0)); | 122 | topControlPanel.setLayout(new BorderLayout(0, 0)); |
123 | 123 | ||
124 | JButton vForwardButton = new JButton("↥"); | 124 | JButton forwardButton = new JButton("↥"); |
125 | vForwardButton.setFont(new Font("Dialog", Font.BOLD, 19)); | 125 | forwardButton.setFont(new Font("Dialog", Font.BOLD, 19)); |
126 | vForwardButton.setToolTipText("Go forward"); | 126 | forwardButton.setToolTipText("Go forward"); |
127 | vTopControlPanel.add(vForwardButton, BorderLayout.CENTER); | 127 | topControlPanel.add(forwardButton, BorderLayout.CENTER); |
128 | 128 | ||
129 | JButton vInventoryButton = new JButton("⇱"); | 129 | JButton inventoryButton = new JButton("⇱"); |
130 | vInventoryButton.setFont(new Font("Dialog", Font.BOLD, 19)); | 130 | inventoryButton.setFont(new Font("Dialog", Font.BOLD, 19)); |
131 | vInventoryButton.setToolTipText("Use item"); | 131 | inventoryButton.setToolTipText("Use item"); |
132 | vTopControlPanel.add(vInventoryButton, BorderLayout.WEST); | 132 | topControlPanel.add(inventoryButton, BorderLayout.WEST); |
133 | 133 | ||
134 | JButton vActionButton = new JButton("⇲"); | 134 | JButton actionButton = new JButton("⇲"); |
135 | vActionButton.setFont(new Font("Dialog", Font.BOLD, 19)); | 135 | actionButton.setFont(new Font("Dialog", Font.BOLD, 19)); |
136 | vActionButton.setToolTipText("Talk/Take item"); | 136 | actionButton.setToolTipText("Talk/Take item"); |
137 | vTopControlPanel.add(vActionButton, BorderLayout.EAST); | 137 | topControlPanel.add(actionButton, BorderLayout.EAST); |
138 | 138 | ||
139 | JPanel vBottomControlPanel = new JPanel(); | 139 | JPanel bottomControlPanel = new JPanel(); |
140 | vControlPanel.add(vBottomControlPanel, BorderLayout.SOUTH); | 140 | controlPanel.add(bottomControlPanel, BorderLayout.SOUTH); |
141 | vBottomControlPanel.setLayout(new BorderLayout(0, 0)); | 141 | bottomControlPanel.setLayout(new BorderLayout(0, 0)); |
142 | 142 | ||
143 | JButton vBackButton = new JButton("↧"); | 143 | JButton backButton = new JButton("↧"); |
144 | vBackButton.setFont(new Font("Dialog", Font.BOLD, 19)); | 144 | backButton.setFont(new Font("Dialog", Font.BOLD, 19)); |