To write a new game you need to create two files: an xml file describing the layout of the client (what it looks like) and a java file that implements the rules of the game. Each game consists of a number of different collections of cards, like a stack or a list of cards. These are defined in the xml file. The java file enables transactions of cards between those collections according to the rules. You can also use other user interface elements like buttons and labels.
The root element of the xml file is called "gameLayout", it can have three types of children. The first type is the "player" element, it holds all the card collections and other user interface elements that belong to one of the players. The player element has an "index" attribute. This attribute is the position of the player at the table. The local player always has index 0 and the player to the local player's left has index 1, and so on.
The second child element is called "common". This holds all the user interface elements that are common to all the players.
Finnally there are the "invisible" elements. These are card collections that aren't shown in the user interface but are referred to in the rules. Typically the main stack of cards (from wich the cards are dealt) is one of the invisible elements. You can't use other user interface elements in the invisible section.
There are 5 types of card collections: "cardList", "sortedCardList", "stack", "trick" and "trickStack" and 4 kinds of other user interface elements: "label", "suitDisplay", "button" and "numberInput". They all have a "name" attribute that has to be unique and that can be used to access them in the java file.
All user interface elements are positioned in the GUI using a "layout" child element, this element follows the GridBagConstraints positioning rules and can have all the attributes that are available for these constraints. Ofcourse the layout element has no use for invisible collections.
The "cardList" is a list of cards that are displayed from left to right partially overlapping each other. The "sortedCardList" looks the same but the cards are displayed in a sorted order that is detirmined according to a Comparator passed to the collection in the java file. They both have 3 additional attributes. The attribute "maxCards" gives an indication on how wide the list needs to be in the GUI, although they can contain more cards during the game. The "rotate" attribute can have the values "0", "90", "180" and "270". These are the degrees that the list is rotated in the GUI. Finally the "faceVisible" attribute sets to whom the face of the cards is visible. The values can be "none", "owner" or "all".
A "cardList" and a "sortedCardList" can also have a "selectButton" attached to it. This button is needed when the java file sends a SelectCardsAction to the player (see later). The button needs to appear in the same section ("player" or "common") as the card list. The "selectButton" has two attributes: the "cardList" and a "label". The "cardList" reffers to the name of the linked card list and the label gets put on the button in the GUI.
The "stack" represents a stack of cards and has only one extra
attribute: "faceVisible". This can have the same values as with a
"cardList".
A "trick" represents the trick in trick taking games. It has an
extra attribute "nbCards", this is the number of cards in a trick and
usually equals the number of players.
A "trickStack" represents the tricks that are collected (taken) by a
player during the game. It has a "maxTricks" and "rotate" attribute.
The "maxTricks" is again used to calculate the size in the GUI. The
"rotate" attribute works the same as in the "cardList".
For other user interface elements you can use: "label", "suitDisplay", "button" and "numberInput".
A label puts some text on the GUI screen. It has two attributes: a "name" and an optional "value". The name is used by the java file and the value gets put on the screen. There are two special labels with the names "playerName" and "score". They always have to be put in the player section of the document and they don't need a value. The first gets replaced with the name of the player that sits on that position and the second with that player's score.
A "suitDisplay" is used to show one of the four suits. It can for example be used to show the thrump suit. It only has a "name" attribute.
A "button" has two attributes: a "name" and a "label". The "name" is used in the java file to reffer to it and the "label" gets shown in the GUI.
A "numberInput" is for example used for the betting in a poker game. Like the "button" it has a "name" and a "label" attribute that both work in the same way as with the "button".
Finally you can also use "panel" elements to group user interface elements and create a more refined layout. A panel always has a layout element as child and can also have card collections, other user interface elements and other panels as children.
A panel can also have an optional "name" attribute. With this you can group user interface elements that are defined in different sections ("player" or "common"). The second occurance of a named panel doesn't need a layout element.