|
|||||||||
| Home >> All >> org >> zazof >> jteg >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.zazof.jteg.gui
Class PlaceArmiesMouseInput

java.lang.Objectjavax.swing.event.MouseInputAdapter
org.zazof.jteg.gui.PlaceArmiesMouseInput
- All Implemented Interfaces:
- java.util.EventListener, javax.swing.event.MouseInputListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, org.zazof.jteg.StateListener
- public class PlaceArmiesMouseInput
- extends javax.swing.event.MouseInputAdapter
- implements org.zazof.jteg.StateListener
- extends javax.swing.event.MouseInputAdapter
Serious rewrite of the PlaceMouseArmiesInput. The old version was rather buggy and often caused the application to crash. This version should do better. This class is responsible for placing the armies on the board, and checking whether the conditions have been met.
| Field Summary | |
private BoardCanvas |
$boardCanvas
|
private int |
$cardArmies
|
private int |
$cardArmiesFixed
|
private int[] |
$continentalArmies
|
private int[] |
$continentalArmiesFixed
|
private java.util.Vector |
$locationsPlaced
|
private MainFrame |
$mainFrame
|
private org.zazof.jteg.Country |
$previouslySelected
|
private int |
$unconditionalArmies
|
private int |
$unconditionalArmiesFixed
|
static int |
AFRICA
|
static int |
ASIA
|
static boolean |
DEBUG
|
static int |
EUROPE
|
static int |
NORTH_AMERICA
|
static int |
OCEANIA
|
static int |
SOUTH_AMERICA
|
| Constructor Summary | |
PlaceArmiesMouseInput(MainFrame frame,
BoardCanvas bc)
|
|
| Method Summary | |
private int |
countOccurences(org.zazof.jteg.Country c)
|
void |
decreaseArmiesToPlace(java.lang.String continentName)
Private datamembers and/or functions |
void |
fixateArmies()
This method should be called directly before this MouseInputAdapter is added to the boardcanvas. |
int |
getNbCardArmies()
This method returns the number of armies that the player at this moment may place which have were caused by a cardbonus returns nbOfCardArmies The number of armies that the player may place thanks to a cards |
int |
getNbContinentalArmies(int continentNumber)
This method returns the number of armies that the player at this moment may place which have no condition. |
int |
getNbUnconditionalArmies()
This method returns the number of armies that the player at this moment may place which have no condition. |
private java.lang.String[] |
getSendArmiesData()
|
int |
getTotalArmiesLeft()
This method returns the total amount of armies which are left for the player to set in this attempt. |
void |
mouseClicked(java.awt.event.MouseEvent me)
Methods to be overrided from MouseInputAdapter |
void |
mouseMoved(java.awt.event.MouseEvent me)
Mouse moved |
private void |
remove(org.zazof.jteg.Country c)
|
void |
restoreToFix()
This method should be called if the placing of the armies went wrong, and we wish to reset to redo the last armieplace operation. |
void |
setContinentArmies(int continentCode)
This method sets the number of armies that the player may place which are caused by the ownership of entire continents. |
void |
setNbCardArmies(int nbOfArmiesToPlace)
This method sets the number of armies that the player may place which are caused by a cardbonus The number to be set is ABSOLUTE param nbOfArmiesToPlace The number of card-bonus-caused armies |
void |
setUnconditionalArmies(int nbOfArmiesToPlace)
This method sets the number of armies that the player may place which have no condition. |
void |
stateChanged(int newState)
StateListener Interface |
| Methods inherited from class javax.swing.event.MouseInputAdapter |
mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
$boardCanvas
private BoardCanvas $boardCanvas
$mainFrame
private MainFrame $mainFrame
$locationsPlaced
private java.util.Vector $locationsPlaced
$previouslySelected
private org.zazof.jteg.Country $previouslySelected
$cardArmies
private int $cardArmies
$cardArmiesFixed
private int $cardArmiesFixed
$unconditionalArmies
private int $unconditionalArmies
$unconditionalArmiesFixed
private int $unconditionalArmiesFixed
$continentalArmies
private int[] $continentalArmies
$continentalArmiesFixed
private int[] $continentalArmiesFixed
SOUTH_AMERICA
public static final int SOUTH_AMERICA
- See Also:
- Constant Field Values
NORTH_AMERICA
public static final int NORTH_AMERICA
- See Also:
- Constant Field Values
AFRICA
public static final int AFRICA
- See Also:
- Constant Field Values
OCEANIA
public static final int OCEANIA
- See Also:
- Constant Field Values
EUROPE
public static final int EUROPE
- See Also:
- Constant Field Values
ASIA
public static final int ASIA
- See Also:
- Constant Field Values
DEBUG
public static final boolean DEBUG
- See Also:
- Constant Field Values
| Constructor Detail |
PlaceArmiesMouseInput
public PlaceArmiesMouseInput(MainFrame frame, BoardCanvas bc)
| Method Detail |
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent me)
- Methods to be overrided from MouseInputAdapter
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent me)
- Description copied from class:
javax.swing.event.MouseInputAdapter - Mouse moved
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
getTotalArmiesLeft
public int getTotalArmiesLeft()
- This method returns the total amount of armies which are left for the player to set in this attempt.
getNbUnconditionalArmies
public int getNbUnconditionalArmies()
- This method returns the number of armies that the player at this moment may place
which have no condition. This means: they are not card-dependent
and he can place them anywhere he wants.
returns nbOfArmiesToPlace The number of unconditional armies that this player may place.
getNbContinentalArmies
public int getNbContinentalArmies(int continentNumber)
- This method returns the number of armies that the player at this moment may place
which have no condition. This means: they are not card-dependent
and he can place them anywhere he wants.
returns nbOfContinentalArmies The number of armies that the player may place, which must be set on continent with a given number
getNbCardArmies
public int getNbCardArmies()
- This method returns the number of armies that the player at this moment may place
which have were caused by a cardbonus
returns nbOfCardArmies The number of armies that the player may place thanks to a cards
setUnconditionalArmies
public void setUnconditionalArmies(int nbOfArmiesToPlace)
- This method sets the number of armies that the player may place
which have no condition. This means: they are not card-dependent
and he can place them anywhere he wants.
The number to be set is ABSOLUTE, no longer incremental. param nbOfArmiesToPlace The number of unconditional armies that this player may place.
setNbCardArmies
public void setNbCardArmies(int nbOfArmiesToPlace)
- This method sets the number of armies that the player may place
which are caused by a cardbonus
The number to be set is ABSOLUTE param nbOfArmiesToPlace The number of card-bonus-caused armies
setContinentArmies
public void setContinentArmies(int continentCode)
- This method sets the number of armies that the player may place
which are caused by the ownership of entire continents.
stateChanged
public void stateChanged(int newState)
- StateListener Interface
- Specified by:
stateChangedin interfaceorg.zazof.jteg.StateListener
fixateArmies
public void fixateArmies()
- This method should be called directly before this MouseInputAdapter is added to the boardcanvas.
It 'fixates' the number of armies that the user can set!
restoreToFix
public void restoreToFix()
- This method should be called if the placing of the armies went wrong, and we wish to reset to redo the
last armieplace operation.
decreaseArmiesToPlace
public void decreaseArmiesToPlace(java.lang.String continentName)
- Private datamembers and/or functions
getSendArmiesData
private java.lang.String[] getSendArmiesData()
remove
private void remove(org.zazof.jteg.Country c)
countOccurences
private int countOccurences(org.zazof.jteg.Country c)
|
|||||||||
| Home >> All >> org >> zazof >> jteg >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC