Path 1: Standard Java GUI Application
Path 1.1 Visual Display
Your application can use any GUI components and layout managers. We recommend that you structure your GUI application based on the following setup:
• Use a Label component to display the word in progress.
• Use a TextArea component to display the diagnostic messages.
•In addition to having the player type in each character, use 26 Button components --- each is marked with a distinct English letter; a player can also click on a button to input the corresponding character.
•After a letter is guessed, please disable it. (See the JButton class page to see how to disable a button).
• Add a new-game button that starts a new game any time you click on it.
•You may want to try different layout managers to control the layout of your application.
•Please set the width and height of your frame to be 500 and 400 respectively.
Path 1.2 Event Handling
•The events will come from 26 buttons. With such a large number of event sources, a recommended approach is to have a single listener that checks for the source of each event. Here is an example that handles two buttons, and you may want to study the code: â—¦(attached zip file of three programs as file 1)
Path 1.3 Development Strategy
Instead of immediately adding the Hangman logic, you would better first write a GUI application that contains all the essential visual components. After it is working, you can incorporate the Hangman logic into your program.
For those of you who want to display an image as the game progresses, here is a sequence of images (attached zip file as file 2) that you may use. For an example on how to display an image Label please see LabelDemo.java and LabelPanel.java.. (attached document as file 3)
Path 2: Android Hangman Android uses a slightly different set of concepts. The top level display is not Frame but a concept called an Activity. To get started, we recommend that you read the Hello World tutorial to install the package and get started:
http://developer.android.com/resources/tutorials/hello-world.html. Please read this document for guidelines (attached as document in zip file 5)
Part 2.1 Visual Display
The recommended visual display is similar to Path 1 above. There are several differences.
•A typical Android application extends the Activity class.
•Typical we use a GUI to design an Android GUI. Here is an zip file for simple push buttons: (PushButtonsAndroid.zip. attached as file in zip file 4)
•For this assignment, please unzip sample Hangman Android (attached as file in zip file 4). Specifically, please download the file, unzip it, and then create an Android project in Eclipse: File >> New >> Projects >> Android >> Android Project from Existing Code, and then browse to the unzipped directory.