cz.nipax.hippo.pexeso
Class NewGameDlg

java.lang.Object
  extended by cz.nipax.hippo.pexeso.NewGameDlg

public class NewGameDlg
extends java.lang.Object

Creates modal dialog to select players for new game. Lets user to select players (AI) and then calls Playground.init, Playground.add_AI and Playground.start Also remembers last slelection for next time of creating this dialog.

Kaffe has problem with showing combo boxes (I don't know why). They apear OK, but changing the value isn't what one would expect. The popup window somehow floats.

See Also:
Playground.init(int, int), Playground.add_AI(cz.nipax.hippo.pexeso.AI, cz.nipax.hippo.pexeso.AI), Playground.start()

Field Summary
private static boolean beastmode
          Remembers beast mode.
private  javax.swing.JComboBox cbox1
          The combobox for selecting first's player AI.
private static int cbox1_sel
          Remembers selection of first player's AI.
private  javax.swing.JComboBox cbox2
          The combobox for selecting second's player AI.
private static int cbox2_sel
          Remembers selection of second player's AI.
private  javax.swing.JDialog dialog
          The dialog window.
private  javax.swing.JCheckBox chbox_beast
          Checkbox for beastmode.
private  javax.swing.JCheckBox chbox_ts
          Checkbox for turn switch
private  Playground pg
          The playground for which this dialog selects players.
private static boolean turnswitch
          Remembers turn switch mode
 
Constructor Summary
NewGameDlg()
          Simple constructor that set all to null.
 
Method Summary
private  javax.swing.JComboBox createCombo()
          Creates new combobox object filled with AI names.
 void createGUI(javax.swing.JFrame frame, Playground pg_in)
          Creates and shows the modal dialog.
private  AI getAI(int ID)
          Creates AI object from selection of combobox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cbox1_sel

private static int cbox1_sel
Remembers selection of first player's AI. It is index of selection in cbox1


cbox2_sel

private static int cbox2_sel
Remembers selection of second player's AI. It is index of selection in cbox2


beastmode

private static boolean beastmode
Remembers beast mode.


turnswitch

private static boolean turnswitch
Remembers turn switch mode


dialog

private javax.swing.JDialog dialog
The dialog window.


cbox1

private javax.swing.JComboBox cbox1
The combobox for selecting first's player AI.


cbox2

private javax.swing.JComboBox cbox2
The combobox for selecting second's player AI.


chbox_beast

private javax.swing.JCheckBox chbox_beast
Checkbox for beastmode.


chbox_ts

private javax.swing.JCheckBox chbox_ts
Checkbox for turn switch


pg

private Playground pg
The playground for which this dialog selects players.

See Also:
Playground
Constructor Detail

NewGameDlg

public NewGameDlg()
Simple constructor that set all to null.

Method Detail

getAI

private AI getAI(int ID)
Creates AI object from selection of combobox. The order of AI names must be synchronized with createCombo()

Parameters:
ID - from which AI is created
Returns:
newly created AI object
See Also:
AI

createCombo

private javax.swing.JComboBox createCombo()
Creates new combobox object filled with AI names. The order for adding AI is relevatn for getAI(int)

Returns:
new combobox object

createGUI

public void createGUI(javax.swing.JFrame frame,
                      Playground pg_in)
Creates and shows the modal dialog. Constructs all buttons and comboboxes. Includes implementation of action listeners for buttons.

Parameters:
frame - the main app frame, parent of this dialog
pg_in - Where to add new AI and start new game. If user clicks cancel button, no method from pg_in is called.