This is a log of what I went through to develop a client for Zombies,
Mutants, and Undead oh My (ZMUohMy).
The project that it is based on is in Subversion at:
The first thing to do is to specify what additional features the Client
would need to support ZMUohMy.
Start by taking a screen shot of the current DarkMud-Redux client and print it out to use as a reference.
Time to go to the source code to find out how the current Client GUI is generated. MudClient.java generates the GUI in its constructor.
The next thing it does is call initComponents() to build the
This method calls createArea() to setup the maim text area with scroll bars. This area is set to 550w x 400h. The area is then passed to a JScrollPane object scroll to managed as a scrollable text area.
The method then sets up two Box objects. Boxes are containers like JPanel, but default to BoxLayout for flow control. These will be used to manage the positioning of user text input field and status line near the bottom of the GUI.
Next, createLable() is called to build up various commonly used text lables.
Then, createTextBoxes() is called to build a used input text field txtInput and set up an ActionListener for it.
Then, createBoxes() is used to add components to the two Box objects previously instantiated.
Finally, it generates a new JPanel and adds the scroll, box1, and box2 components to it and sets up a border.
First, a new Box is made to hold both the scroll object and the
new panel called boxRight.
A new method is added call createUserInfoBoxes to build up all of the new components. There is a multipart JLabel for the name, class, and level info and four JLabels and their associated JScrollPane/JTextPanels; one for each of the info areas.
Four new EventHandlers will also be needed and the message handler will need to be adjusted to support new info messages from the server.
The code design will be:
1. Remove the leading @ character from the message.
2. Copy everything before the # into a temp String.
3. Send the temp to the list parser.
4. Repeat for each of the four lists or until no more tokens.
(see code in ClientInfo.java for details)
Almost works..only Stats show up..parser doesn't see the second list..had to add delimiter to end of last list pair
Also had to add this.validate() after updateing the lists to get all of them to show up.
New test string set up in MudUser.java
command.addOutput("9mm Pistol,1|First Aid Kits,1#");
"@Health,100|Strength,23#Lock Pick,2|Perception,3#9mm Pistol,1|First Aid Kits,1#None,0#"
Info shows up in lists, but every time "info" is sent, the same items are added to the lists again..need to stop duplicatons.
Simple to do a .removeAll before adding anything to the list since these are complete list updates anyway.
Added a message type of two digits after the @ character. This will be used to further parse infomation messages when a
list element is selected.
In MudMain.java.loggedIn(), added a send "info" message after login welcome.
Now that the message format is setup and message passing is inplace a new document will look at supporting the list message content. (see InfoListsContentControl.html)
Moving Specialty down under name. Adding a label for experience. Adding a setName method.
Adding a message type 01 for sending Experience to Client. Level is based on experience.
Adding type 02 message to change Profession/Specialty
Add setNameLabel( )
Add updateExperience( )
Add setProfession( )
Add call to setNameLabel()
Use "info" and MudUser.processInfoCommand() to test "01" and "02" messages. This was left over from earlier changes.
All looks ok..back to the server.