public class UserInterface extends java.lang.Object implements java.awt.event.ActionListener
| Modifier and Type | Field and Description |
|---|---|
private javax.swing.JButton |
East |
private GameEngine |
engine |
private javax.swing.JTextField |
entryField |
private javax.swing.JButton |
help |
private javax.swing.JLabel |
image |
private javax.swing.JTextArea |
log |
private javax.swing.JFrame |
myFrame |
private javax.swing.JButton |
North |
private javax.swing.JButton |
South |
private javax.swing.JButton |
West |
| Constructor and Description |
|---|
UserInterface(GameEngine gameEngine)
Construct a UserInterface.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Actionlistener interface for entry textfield.
|
private void |
createGUI()
Set up graphical user interface.
|
void |
enable(boolean on)
Enable or disable input in the input field.
|
void |
print(java.lang.String text)
Print out some text into the text area.
|
void |
println(java.lang.String text)
Print out some text into the text area, followed by a line break.
|
private void |
processCommand()
A command has been entered.
|
void |
showImage(java.lang.String imageName)
Show an image file in the interface.
|
private GameEngine engine
private javax.swing.JFrame myFrame
private javax.swing.JTextField entryField
private javax.swing.JTextArea log
private javax.swing.JLabel image
private javax.swing.JButton help
private javax.swing.JButton North
private javax.swing.JButton South
private javax.swing.JButton East
private javax.swing.JButton West
public UserInterface(GameEngine gameEngine)
gameEngine - The GameEngine object implementing the game logic.public void print(java.lang.String text)
public void println(java.lang.String text)
public void showImage(java.lang.String imageName)
public void enable(boolean on)
private void createGUI()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerprivate void processCommand()