|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JInternalFrame
|
+--au.com.solidsoftware.multimahjong.mmc.usergui.GameTypeSelector
An internal frame that allows the user to select the type of game to play and to enter their name and icon. In addition, if the user chooses to start a new game (single or multi player), they will also be allowed to set the score limit of the game.
The top-left portion of the internal frame contains a splash graphic. This graphic is to be supplied by the Client, and is likely to incorporate the company logo and a product identification graphic.
The top-right portion of the internal frame is occupied with a list of three vertically aligned radio buttons, allowing the user to select between "Start new single player game", "Start new multiplayer game", or "Join existing multiplayer game".
The remainder of the internal frame (the entire bottom portion) will allow the user to enter their name and icon. The score limit can also be set here if the user is starting a new game. If the user is joining an existing multi player game, this option will be disabled.

A text field will be displayed to allow the input of the server address. This is enabled only if the player if starting or joining a multi player game.
Importantly, the bottom portion also contains a "Next >>" button, which dismisses the internal frame and displays the playing screen, the MultiGameStarter, or the MultiGameJoiner, depending on whether the user chose to start a new single player game, to start a new multi player game, or to join an existing multi player game, respectively. Since this is likely to take some time, a "Please Wait" label, accompanied by an animated image, will be displayed upon clicking the "Next >>" button.

An "Exit" button is also present to allow the user to exit the program altogether. A dialog box will be displayed to allow to user to confirm their decision to exit the program.

The icon is selected from a list of icons within a drop-down combo box, while the user's name is entered in a text input field. The score limit is entered via an editable combo box, which provides a list a suggested score limits.

| Inner Class Summary | |
(package private) class |
GameTypeSelector.ServerTextFieldDocumentListener
An inner class that listens for any DocumentEvent
originating from the server name text input field. |
(package private) class |
GameTypeSelector.TextFieldDocumentListener
An inner class that listens for any DocumentEvent
originating from the user name text input field. |
| Inner classes inherited from class javax.swing.JInternalFrame |
javax.swing.JInternalFrame.AccessibleJInternalFrame,
javax.swing.JInternalFrame.JDesktopIcon |
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent,
javax.swing.JComponent.IntVector,
javax.swing.JComponent.KeyboardBinding,
javax.swing.JComponent.KeyboardState |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
| Field Summary | |
private java.lang.String |
gameType
The type of game that the user selected. |
private int |
iconID
The ID number of the player's icon. |
private static java.lang.String |
JOINMULTI
A String constant referring to the radio button for
joining an existing multiplayer game. |
private int |
limit
The score limit. |
private javax.swing.JComboBox |
limitInputCombo
The editable combo box used to enter the score limit. |
private java.lang.String |
name
The name of the player. |
private static java.lang.String |
NEWMULTI
A String constant referring to the radio button for
starting a new multiplayer game. |
private static java.lang.String |
NEWSINGLE
A String constant referring to the radio button for
starting a new single player game. |
private Registrar |
registrar
A reference to the server-side Registrar, which handles
the starting, joining and ending of multi player games. |
private java.lang.String |
server
The address where the MultiMahjongServer resides. |
private javax.swing.JTextField |
serverInputField
The text field used to enter the name of the server. |
| Fields inherited from class javax.swing.JInternalFrame |
closable,
CONTENT_PANE_PROPERTY,
defaultCloseOperation,
desktopIcon,
FRAME_ICON_PROPERTY,
frameIcon,
GLASS_PANE_PROPERTY,
iconable,
IS_CLOSED_PROPERTY,
IS_ICON_PROPERTY,
IS_MAXIMUM_PROPERTY,
IS_SELECTED_PROPERTY,
isClosed,
isIcon,
isMaximum,
isSelected,
LAYERED_PANE_PROPERTY,
maximizable,
MENU_BAR_PROPERTY,
opened,
resizable,
ROOT_PANE_PROPERTY,
rootPane,
rootPaneCheckingEnabled,
title,
TITLE_PROPERTY,
uiClassID |
| Fields inherited from class javax.swing.JComponent |
_bounds,
accessibleContext,
alignmentX,
alignmentY,
ANCESTOR_USING_BUFFER,
ancestorNotifier,
autoscroller,
border,
changeSupport,
clientProperties,
flags,
HAS_FOCUS,
IS_DOUBLE_BUFFERED,
IS_OPAQUE,
IS_PAINTING_TILE,
KEYBOARD_BINDINGS_KEY,
listenerList,
maximumSize,
minimumSize,
NEXT_FOCUS,
paintImmediatelyClip,
preferredSize,
readObjectCallbacks,
REQUEST_FOCUS_DISABLED,
tmpRect,
TOOL_TIP_TEXT_KEY,
ui,
uiClassID,
UNDEFINED_CONDITION,
vetoableChangeSupport,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
component,
containerListener,
containerSerializedDataVersion,
dispatcher,
layoutMgr,
maxSize,
ncomponents,
serialVersionUID |
| Fields inherited from class java.awt.Component |
actionListenerK,
adjustmentListenerK,
appContext,
assert,
background,
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
changeSupport,
componentListener,
componentListenerK,
componentOrientation,
componentSerializedDataVersion,
containerListenerK,
cursor,
dropTarget,
enabled,
eventMask,
focusListener,
focusListenerK,
font,
foreground,
hasFocus,
height,
incRate,
inputMethodListener,
inputMethodListenerK,
isInc,
isPacked,
itemListenerK,
keyListener,
keyListenerK,
LEFT_ALIGNMENT,
locale,
LOCK,
minSize,
mouseListener,
mouseListenerK,
mouseMotionListener,
mouseMotionListenerK,
name,
nameExplicitlySet,
newEventsOnly,
ownedWindowK,
parent,
peer,
peerFont,
popups,
prefSize,
RIGHT_ALIGNMENT,
serialVersionUID,
textListenerK,
TOP_ALIGNMENT,
valid,
visible,
width,
windowListenerK,
x,
y |
| Constructor Summary | |
GameTypeSelector(UserGUI userGUI)
Creates a new instance of GameTypeSelector and displays
the internal frame in the centre of the application window. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
The method invoked when a radio button is selected. |
private javax.swing.JPanel |
createOptionsPane(UserGUI userGUI)
Creates the options pane, which contains a drop-down combo box for selecting the user's icon, a text input field for entering the user's name, an editable combo box for entering the score limit, and a button for dismissing the internal frame. A combo box with a list of available icons is created and added to this pane. |
private javax.swing.JPanel |
createRadioPane()
Creates the radio pane, which contains a list of three vertically aligned radio buttons. |
private javax.swing.JPanel |
createSplashPane()
Creates the splash pane, which contains a clickable splash graphic. |
Registrar |
getRegistrar()
Access method - returns a reference to the registrar. |
| Methods inherited from class javax.swing.JInternalFrame |
addImpl,
addInternalFrameListener,
createRootPane,
createRootPaneException,
dispose,
doDefaultCloseAction,
fireInternalFrameEvent,
getAccessibleContext,
getBackground,
getContentPane,
getDefaultCloseOperation,
getDesktopIcon,
getDesktopPane,
getForeground,
getFrameIcon,
getGlassPane,
getJMenuBar,
getLayer,
getLayeredPane,
getMenuBar,
getRootPane,
getTitle,
getUI,
getUIClassID,
getWarningString,
isClosable,
isClosed,
isIcon,
isIconifiable,
isMaximizable,
isMaximum,
isResizable,
isRootPaneCheckingEnabled,
isSelected,
moveToBack,
moveToFront,
pack,
paramString,
removeInternalFrameListener,
reshape,
setBackground,
setClosable,
setClosed,
setContentPane,
setDefaultCloseOperation,
setDesktopIcon,
setForeground,
setFrameIcon,
setGlassPane,
setIcon,
setIconifiable,
setJMenuBar,
setLayer,
setLayeredPane,
setLayout,
setMaximizable,
setMaximum,
setMenuBar,
setResizable,
setRootPane,
setRootPaneCheckingEnabled,
setSelected,
setTitle,
setUI,
setVisible,
show,
startModal,
stopModal,
toBack,
toFront,
updateUI,
updateUIWhenHidden,
writeObject |
| Methods inherited from class javax.swing.JComponent |
_paintImmediately,
|
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
applyOrientation,
countComponents,
deliverEvent,
dispatchEventImpl,
dispatchEventToSelf,
doLayout,
eventEnabled,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents_NoClientCode,
getComponents,
getLayout,
getMouseEventTarget,
getWindow,
initIDs,
insets,
invalidate,
invalidateTree,
isAncestorOf,
layout,
lightweightPrint,
list,
list,
locate,
minimumSize,
nextFocus,
paintComponents,
postProcessKeyEvent,
postsOldMouseEvents,
preferredSize,
preProcessKeyEvent,
print,
printComponents,
printOneComponent,
processContainerEvent,
processEvent,
proxyEnableEvents,
proxyRequestFocus,
remove,
remove,
removeAll,
removeContainerListener,
setFocusOwner,
transferFocus,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
areInputMethodsEnabled,
bounds,
checkImage,
checkImage,
coalesceEvents,
constructComponentName,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont_NoClientCode,
getFont,
getFontMetrics,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getNativeContainer,
getParent_NoClientCode,
getParent,
getPeer,
getSize,
getToolkit,
getToolkitImpl,
getTreeLock,
getWindowForObject,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isEnabledImpl,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
| Field Detail |
private static final java.lang.String NEWSINGLE
String constant referring to the radio button for
starting a new single player game. This also serves as the button
label.private static final java.lang.String NEWMULTI
String constant referring to the radio button for
starting a new multiplayer game. This also serves as the button
label.private static final java.lang.String JOINMULTI
String constant referring to the radio button for
joining an existing multiplayer game. This also serves as the button
label.private java.lang.String name
private int iconID
private int limit
private java.lang.String server
private java.lang.String gameType
String
(one of NEWSINGLE, NEWMULTI or
JOINMULTI) referring to the radio button selected by the
user.private javax.swing.JComboBox limitInputCombo
private javax.swing.JTextField serverInputField
private Registrar registrar
Registrar, which handles
the starting, joining and ending of multi player games.| Constructor Detail |
public GameTypeSelector(UserGUI userGUI)
GameTypeSelector and displays
the internal frame in the centre of the application window. The
createSplashPane, createRadioPane and
createOptionsPane methods are invoked to create the splash
graphic, the list of radio buttons, and the input fields, respectively.
These three panes are then added to the internal frame's content
pane.userGUI - a reference to the parent UserGUI object| Method Detail |
private javax.swing.JPanel createSplashPane()
JButton. Moving the mouse
cursor over this button will cause the image to change, and clicking on
this button will display an "About" dialog box - the
ActionListener attached to this button will invoke the
showAboutDialog method upon receiving an
ActionEvent.private javax.swing.JPanel createRadioPane()
An ActionListener is added to each of the buttons so that
gameType is set whenever a radio button is selected.
These three radio buttons are mutually exclusive and therefore all
belong to a single ButtonGroup.
The "Start new single player game" option is selected by default.
private javax.swing.JPanel createOptionsPane(UserGUI userGUI)
A combo box with a list of available icons is created and added to this
pane. The ActionListener attached to this combo box invokes
the Player.setIcon(javax.swing.ImageIcon) method upon receiving an
ActionEvent.
A text input field initialised with the text "Anonymous" is created and
added to this pane. The DocumentListener
GameTypeSelector.TextFieldDocumentListener is attached to this
text input field and invokes the Player.setName(java.lang.String) method upon
receiving a DocumentEvent.
An editable combo box with a list of suggested score limits is created
and added to this pane. The ActionListener attached to this
combo box invokes the Preferences#setLimit method upon receiving
an ActionEvent.
This pane also contains a "Next >>" button, which dismisses the internal frame and displays the playing screen, the MultiGameStarter, or the MultiGameJoiner, depending on whether the user chose to start a new single player game, to start a new multiplayer game, or to join an existing multiplayer game, respectively. An "Exit" button is also present to allow the user to exit the program altogether.
userGUI - A reference to the parent UserGUI object.public Registrar getRegistrar()
public void actionPerformed(java.awt.event.ActionEvent e)
gameType and enables/disables the score limit combo box
depending upon the radio button selected.e - a semantic event which indicates that a component-defined
action occured
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||