de.uni_paderborn.robots.gui
Class ArenaFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--de.uni_paderborn.robots.gui.ArenaFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class ArenaFrame
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.KeyListener

Main window of the game.

See Also:
Serialized Form

Inner Class Summary
private  class ArenaFrame.GameTime
          This thread computes the current game time.
private  class ArenaFrame.LoadArenaFileFilter
          The FileFilter for loading the arena, thus only files ending with ".arena" are shown.
private  class ArenaFrame.LoadRobotFileFilter
          The FileFilter for loading a robot, thus only files ending with ".class" are shown.
private  class ArenaFrame.LoadRobotListFileFilter
          The FileFilter for loading a robotlist, thus only files ending with ".robotlist" are shown.
private  class ArenaFrame.PauseGameMenuListener
          The MenuListener to recognize menu activation.
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private  javax.swing.JMenuItem aboutMI
          the MenuItem for calling the about window
private  Arena arena
          the arena
private  ArenaCanvas arenaCanvas
          the arena canvas
private  boolean automaticPaused
          true, if game was automatically paused by menu listener
private  javax.swing.JLabel clockLabel
          label for clock
private  javax.swing.ImageIcon continueIcon
          the ImageIcon when the game is paused
private  javax.swing.JButton debugButton
          the button of the toolbar for turning debug mode on/off
private  javax.swing.JCheckBoxMenuItem debugModeCMI
          the CheckBoxMenuItem for turning DEBUG mode on/off
private  DebugWindow debugWindow
          debug window
private  javax.swing.JButton deleteRobotButton
          the button of the toolbar for deleting a robot
private  javax.swing.JMenuItem deleteRobotMI
          the MenuItem for removing a robot
private  javax.swing.JButton disqualifyButton
          the button of the toolbar for disqualifying a robot
private  javax.swing.JMenuItem disqualifyRobotMI
          the MenuItem for disqualifying a robot
private  javax.swing.JMenuItem endProgramMI
          the MenuItem for exiting the program
private  javax.swing.JMenu fileMenu
          the file menu
private  boolean gameActive
          true, if game is active (not paused)
private  javax.swing.JMenu gameMenu
          the game menu
private  boolean gameRunning
          true, if game is running (between start/stop)
private  ArenaFrame.GameTime gameTime
          GameTime thread
private  javax.swing.JMenu helpMenu
          the help menu
private  javax.swing.JMenuItem helpMI
          the MenuItem for calling the help window
private  boolean isBlocked
          true, if action (buttons, menu, toolbar) event handling is blocked, false if not
private  javax.swing.JScrollPane jScrollPane
          the scroll panel containing the ArenaCanvas
private  Fields lastFields
          last Fields objects for resetting game
private  javax.swing.JButton loadArenaButton
          the button of the toolbar for loading a new arena
private  javax.swing.JMenuItem loadArenaMI
          the MenuItem for loading a new arena
private  javax.swing.JButton loadRobotButton
          the button of the toolbar for loading a new robot
private  javax.swing.JButton loadRobotListButton
          the button of the toolbar for loading a list fo robots
private  javax.swing.JMenuItem loadRobotListMI
          the MenuItem for loading a list of robots previousliy saved
private  javax.swing.JMenuItem loadRobotMI
          the MenuItem for loading a robot
private  javax.swing.JMenuBar menubar
          the menubar of the frame
private  javax.swing.JMenu optionsMenu
          the options menu
private  javax.swing.JButton pauseButton
          the button of the toolbar for pausing or resuming the game
private  javax.swing.ImageIcon pauseIcon
          the ImageIcon when the game is in running
private  javax.swing.JMenuItem pauseResumeMI
          the MenuItem for pausing an resuming the game
private  javax.swing.JButton quitButton
          the button of the toolbar for quitting the application
private  javax.swing.JButton resetButton
          the button of the toolbar for resetting the game
private  javax.swing.JMenuItem resetMI
          the MenuItem for resetting the game
private  javax.swing.JMenuItem saveArenaMI
          the MenuItem for saving an arena
private  javax.swing.JButton saveRobotListButton
          the button of the toolbar for saving a list of robots
private  javax.swing.JMenuItem saveRobotListMI
          the MenuItem for saving all loaded robots in a list
private  javax.swing.JMenuItem setDelayMI
          the MenuItem for setting the delay
private  javax.swing.JMenuItem setEnergyMI
          the MenuItem for setting the maximum energy
private  javax.swing.JMenuItem setPunishmentMI
          the MenuItem for setting the punishment amount
private  javax.swing.JMenuItem setRechargerMI
          the MenuItem for setting the recharger amount
private  javax.swing.JMenuItem startArenaDesignerMI
          the MenuItem for starting the ArenaDesigner
private  javax.swing.JButton startButton
          the button of the toolbar for starting the game
private  javax.swing.JMenuItem startStopMI
          the MenuItem for starting and stopping the game
private  StatisticPanel statisticPanel
          statistic panel
private  javax.swing.JButton stepButton
          the button of the toolbar for next step in debug mode
private  javax.swing.JMenuItem stepMI
          the MenuItem for performing next debug step
private  javax.swing.JButton stopButton
          the button of the toolbar for stopping the game
private  javax.swing.JToolBar toolbar
          the toolbar
private  javax.swing.JLabel turnNumberLabel
          label for turn number
private  javax.swing.JMenu viewMenu
          the view menu
private  javax.swing.JCheckBoxMenuItem zoomMI
          the zoom menu item
 
Fields inherited from class javax.swing.JFrame
accessibleContext, defaultCloseOperation, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, warningString, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ArenaFrame()
          constructor, creates a new ArenaFrame
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles all action events from menu and toolbar.
 void block(boolean on)
          Turns event handling blocker on or off.
private  boolean checkRobotClass(java.lang.Class clazz)
          Checks if the given class implements the interface RobotFunctions.
 void checkRobotNumber()
          This method checks the number of robots in the arena.
 void clearDebugWindow()
          Clears the debug window.
private  void deleteRobot()
          Opens a frame which shows a list of all the robots.
 void disqualificationDialog(java.lang.String message, Robot robot)
          Shows disqualification dialog
private  void disqualifyRobot(Robot robot)
          Opens a frame which shows a list of all non-disqualified robots.
 Arena getArena()
          Gets Arena for this ArenaFrame.
 ArenaCanvas getArenaCanvas()
          Gets ArenaCanvas for this ArenaFrame.
private  java.lang.String getRobotName(RobotFunctions robotFunctions)
          This method extract the robot name from the class name of the RobotFunctions object.
 StatisticPanel getStatisticPanel()
          Gets StatisticPanel for this ArenaFrame.
private  void initComponents()
          This method is called from within the constructor to initialize the GUI.
 void keyPressed(java.awt.event.KeyEvent e)
          This method is invoked when a key has been pressed.
 void keyReleased(java.awt.event.KeyEvent e)
          This method is invoked when a key has been released.
 void keyTyped(java.awt.event.KeyEvent e)
          This method is invoked when a key has been typed.
private  void loadArena()
          Loads an existing arena from a local file.
private  boolean loadArena(java.io.File file)
          Loads an arena from a local file into this class.
private  void loadRobot()
          This methods is used to load robot files by a JFileChooser.
private  RobotFunctions loadRobotClass(java.io.File file, boolean check)
          Tries to load a robot class specified by the filename.
private  void loadRobotList()
          This method loads robots from from a list by a JFileChooser.
private  void pauseGame()
          This method pauses the game.
 void printDebugMessage(java.lang.String message)
          Prints message to debug window.
private  void resetGame()
          Resets the game.
private  void resumeGame()
          This method resumes the game.
private  void saveArena()
          Saves the actual arena to a local file.
private  boolean saveArena(java.io.File file)
          Savess an arena to a local file.
private  void saveRobotList()
          This method saves all the robots that are in the iterator to a file.
 void setActualTurnNo(int turnNo)
          Sets the actual turn number.
private  void setDelayBox()
          This method will change the delay.
private  void setEnergyBox()
          This method will change the default energy.
private  void setPunishmentBox()
          This method will change the default punishment energy.
private  void setRechargerBox()
          This method will change the default recharge energy.
 void showMessage(java.lang.String message)
          Shows a message about a robot.
 void showRanking(java.lang.String message, Robot[] robots, int[] points)
          Shows a window with the final ranking after stopping game.
private  void startGame()
          This method starts the game.
private  void stopGame()
          This method stops the game.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, createRootPaneException, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

arena

private Arena arena
the arena

arenaCanvas

private ArenaCanvas arenaCanvas
the arena canvas

statisticPanel

private StatisticPanel statisticPanel
statistic panel

debugWindow

private DebugWindow debugWindow
debug window

lastFields

private Fields lastFields
last Fields objects for resetting game

isBlocked

private boolean isBlocked
true, if action (buttons, menu, toolbar) event handling is blocked, false if not

menubar

private javax.swing.JMenuBar menubar
the menubar of the frame

fileMenu

private javax.swing.JMenu fileMenu
the file menu

loadArenaMI

private javax.swing.JMenuItem loadArenaMI
the MenuItem for loading a new arena

saveArenaMI

private javax.swing.JMenuItem saveArenaMI
the MenuItem for saving an arena

loadRobotMI

private javax.swing.JMenuItem loadRobotMI
the MenuItem for loading a robot

deleteRobotMI

private javax.swing.JMenuItem deleteRobotMI
the MenuItem for removing a robot

saveRobotListMI

private javax.swing.JMenuItem saveRobotListMI
the MenuItem for saving all loaded robots in a list

loadRobotListMI

private javax.swing.JMenuItem loadRobotListMI
the MenuItem for loading a list of robots previousliy saved

disqualifyRobotMI

private javax.swing.JMenuItem disqualifyRobotMI
the MenuItem for disqualifying a robot

endProgramMI

private javax.swing.JMenuItem endProgramMI
the MenuItem for exiting the program

gameMenu

private javax.swing.JMenu gameMenu
the game menu

resetMI

private javax.swing.JMenuItem resetMI
the MenuItem for resetting the game

startStopMI

private javax.swing.JMenuItem startStopMI
the MenuItem for starting and stopping the game

pauseResumeMI

private javax.swing.JMenuItem pauseResumeMI
the MenuItem for pausing an resuming the game

debugModeCMI

private javax.swing.JCheckBoxMenuItem debugModeCMI
the CheckBoxMenuItem for turning DEBUG mode on/off

stepMI

private javax.swing.JMenuItem stepMI
the MenuItem for performing next debug step

viewMenu

private javax.swing.JMenu viewMenu
the view menu

zoomMI

private javax.swing.JCheckBoxMenuItem zoomMI
the zoom menu item

optionsMenu

private javax.swing.JMenu optionsMenu
the options menu

setEnergyMI

private javax.swing.JMenuItem setEnergyMI
the MenuItem for setting the maximum energy

setDelayMI

private javax.swing.JMenuItem setDelayMI
the MenuItem for setting the delay

setRechargerMI

private javax.swing.JMenuItem setRechargerMI
the MenuItem for setting the recharger amount

setPunishmentMI

private javax.swing.JMenuItem setPunishmentMI
the MenuItem for setting the punishment amount

startArenaDesignerMI

private javax.swing.JMenuItem startArenaDesignerMI
the MenuItem for starting the ArenaDesigner

helpMenu

private javax.swing.JMenu helpMenu
the help menu

aboutMI

private javax.swing.JMenuItem aboutMI
the MenuItem for calling the about window

helpMI

private javax.swing.JMenuItem helpMI
the MenuItem for calling the help window

toolbar

private javax.swing.JToolBar toolbar
the toolbar

loadArenaButton

private javax.swing.JButton loadArenaButton
the button of the toolbar for loading a new arena

loadRobotButton

private javax.swing.JButton loadRobotButton
the button of the toolbar for loading a new robot

deleteRobotButton

private javax.swing.JButton deleteRobotButton
the button of the toolbar for deleting a robot

loadRobotListButton

private javax.swing.JButton loadRobotListButton
the button of the toolbar for loading a list fo robots

saveRobotListButton

private javax.swing.JButton saveRobotListButton
the button of the toolbar for saving a list of robots

resetButton

private javax.swing.JButton resetButton
the button of the toolbar for resetting the game

startButton

private javax.swing.JButton startButton
the button of the toolbar for starting the game

pauseButton

private javax.swing.JButton pauseButton
the button of the toolbar for pausing or resuming the game

stopButton

private javax.swing.JButton stopButton
the button of the toolbar for stopping the game

disqualifyButton

private javax.swing.JButton disqualifyButton
the button of the toolbar for disqualifying a robot

debugButton

private javax.swing.JButton debugButton
the button of the toolbar for turning debug mode on/off

stepButton

private javax.swing.JButton stepButton
the button of the toolbar for next step in debug mode

quitButton

private javax.swing.JButton quitButton
the button of the toolbar for quitting the application

pauseIcon

private javax.swing.ImageIcon pauseIcon
the ImageIcon when the game is in running

continueIcon

private javax.swing.ImageIcon continueIcon
the ImageIcon when the game is paused

jScrollPane

private javax.swing.JScrollPane jScrollPane
the scroll panel containing the ArenaCanvas

gameRunning

private boolean gameRunning
true, if game is running (between start/stop)

gameActive

private boolean gameActive
true, if game is active (not paused)

automaticPaused

private boolean automaticPaused
true, if game was automatically paused by menu listener

clockLabel

private javax.swing.JLabel clockLabel
label for clock

gameTime

private ArenaFrame.GameTime gameTime
GameTime thread

turnNumberLabel

private javax.swing.JLabel turnNumberLabel
label for turn number
Constructor Detail

ArenaFrame

public ArenaFrame()
constructor, creates a new ArenaFrame
Method Detail

loadArena

private boolean loadArena(java.io.File file)
Loads an arena from a local file into this class.
Parameters:
file - a local file
Returns:
true, if arena was loaded successfully

saveArena

private boolean saveArena(java.io.File file)
Savess an arena to a local file.
Parameters:
file - a local file
Returns:
true, if arena was saved successfully

initComponents

private void initComponents()
This method is called from within the constructor to initialize the GUI.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles all action events from menu and toolbar.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the ActionEvent

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
This method is invoked when a key has been typed.
Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
e - the KeyEvent.

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
This method is invoked when a key has been pressed.
Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
e - the KeyEvent.

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
This method is invoked when a key has been released.
Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
e - the KeyEvent.

block

public void block(boolean on)
Turns event handling blocker on or off.
Parameters:
on - true, if event handling blocker should be turned on, false if not

getArenaCanvas

public ArenaCanvas getArenaCanvas()
Gets ArenaCanvas for this ArenaFrame.
Returns:
ArenaCanvas for this ArenaFrame

getStatisticPanel

public StatisticPanel getStatisticPanel()
Gets StatisticPanel for this ArenaFrame.
Returns:
StatisticPanel for this ArenaFrame

getArena

public Arena getArena()
Gets Arena for this ArenaFrame.
Returns:
Arena for this ArenaFrame

loadArena

private void loadArena()
Loads an existing arena from a local file.

saveArena

private void saveArena()
Saves the actual arena to a local file.

resetGame

private void resetGame()
Resets the game.

startGame

private void startGame()
This method starts the game. It is called when the startButton or the startStopMI is clicked.

pauseGame

private void pauseGame()
This method pauses the game.

resumeGame

private void resumeGame()
This method resumes the game.

stopGame

private void stopGame()
This method stops the game.

checkRobotClass

private boolean checkRobotClass(java.lang.Class clazz)
Checks if the given class implements the interface RobotFunctions.
Parameters:
clazz - the Class object
Returns:
true, if the class implements RobotFunctions, false, if not

loadRobotClass

private RobotFunctions loadRobotClass(java.io.File file,
                                      boolean check)
Tries to load a robot class specified by the filename. If this is successfull, the RobotFunction interface is returned, otherwise null.
Parameters:
file - the class file to load.
check - true, if we are in check mode only
Returns:
RobotFunctions interface if success, null if not

loadRobot

private void loadRobot()
This methods is used to load robot files by a JFileChooser.

getRobotName

private java.lang.String getRobotName(RobotFunctions robotFunctions)
This method extract the robot name from the class name of the RobotFunctions object.
Parameters:
robotFunctions - the object implementing RobotFunctions
Returns:
name of the robot

checkRobotNumber

public void checkRobotNumber()
This method checks the number of robots in the arena. This is necessary when a robot was removed from the arena, because this could be the last one!

saveRobotList

private void saveRobotList()
This method saves all the robots that are in the iterator to a file.

loadRobotList

private void loadRobotList()
This method loads robots from from a list by a JFileChooser.

setEnergyBox

private void setEnergyBox()
This method will change the default energy.

setRechargerBox

private void setRechargerBox()
This method will change the default recharge energy.

setPunishmentBox

private void setPunishmentBox()
This method will change the default punishment energy.

setDelayBox

private void setDelayBox()
This method will change the delay.

deleteRobot

private void deleteRobot()
Opens a frame which shows a list of all the robots. The user may choose which robot to delete

disqualifyRobot

private void disqualifyRobot(Robot robot)
Opens a frame which shows a list of all non-disqualified robots. The user may choose which robot to disqualify.
Parameters:
robot - the robot to choose by default in the dialog, null, if no robot is to be chosen

showRanking

public void showRanking(java.lang.String message,
                        Robot[] robots,
                        int[] points)
Shows a window with the final ranking after stopping game.
Parameters:
message - the message to be shown before showing the ranking, if null no message is displayed
robots - the robots given in ranking order
points - the points of the robots given in ranking order

disqualificationDialog

public void disqualificationDialog(java.lang.String message,
                                   Robot robot)
Shows disqualification dialog
Parameters:
message - the message to be shown before showing the ranking
robot - the robot to choose by default in the dialog, null, if no robot is to be chosen

printDebugMessage

public void printDebugMessage(java.lang.String message)
Prints message to debug window.
Parameters:
message - message to be displayed in debug window

showMessage

public void showMessage(java.lang.String message)
Shows a message about a robot.
Parameters:
message - the message to be shown

setActualTurnNo

public void setActualTurnNo(int turnNo)
Sets the actual turn number.

clearDebugWindow

public void clearDebugWindow()
Clears the debug window.