de.uni_paderborn.robots.gui
Class LastActionRobot

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

public class LastActionRobot
extends javax.swing.JFrame

The class LastActionRobot is both the main class of the euqally named simulation and the graphical user interface.

See Also:
Serialized Form

Inner Class Summary
private  class LastActionRobot.ArenaStyleChooser
          The frame where you can choose an arena style.
private  class LastActionRobot.DeleteRobotChooser
          The frame where you can delete a robot.
private  class LastActionRobot.DisqualifyChooser
          The frame where you can choose the robot to be disqualified.
private static class LastActionRobot.EasterEggs
          The class for the EasterEggs ;o)
private  class LastActionRobot.GUIActionListener
          this class, implementing the ActionListener interface, is used for the MenuItems an the buttons of the toolbar.
private  class LastActionRobot.LoadArenaFileFilter
          The FileFilter for loading the arena, thus only files ending with ".arena" are shown.
private  class LastActionRobot.LoadRobotFileFilter
          The FileFilter for loading a robot, thus only files ending with ".class" are shown.
private  class LastActionRobot.LoadRobotListFileFilter
          The FileFilter for loading a robotlist, thus only files ending with ".robotlist" are shown.
private  class LastActionRobot.SetEnergyBox
          Class for the SetEnergyBox frame where you can set the maximum energy of every robot.
private  class LastActionRobot.SetStatusLabel
          This class is implemented in order to show the message in the statuslabel just for 8 seconds.
private  class LastActionRobot.StatusRobotComponent
          class to present the status of one robot in the upper left corner of the frame.
 
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  Arena arena
          our little, cute arena
private  javax.swing.JMenuItem arenaDesignerMI
          the MenuItem for starting the arenaDesigner
private  ArenaImages arenaImages
          the images for the arena field items
private  javax.swing.JPanel arenaPanel
          the panel where the arena is placed in
private  javax.swing.JScrollPane arenaScrollPane
          the ScrollPane where the arena is placed in
private  int arenaSize
          the current arena size, that is nearly the size of each arena image.
private  javax.swing.JPanel bottomStatusPanel
          the panel where the status label at the bottom is placed in
private  javax.swing.ImageIcon continueIcon
          the ImageIcon when the game is paused
private  javax.swing.JMenuItem creditsMI
          the MenuItem for calling the frame showing the credits
private  java.lang.String currentDir
          the current directory of the arena.
(package private)  CutScene cut
          The object for the CutScenes
private  javax.swing.JMenuItem cutScenesMI
          the MenuItem for changing the modalities of the CutScenes
private  javax.swing.JButton deleteRobotButton
          the button of the toolbar for deleting a robot
private  javax.swing.JMenuItem deleteRobotMI
          the MenuItem for delteing a robot
private  javax.swing.JButton disqualifyButton
          the button of the toolbar for disqualifying a robot
private  javax.swing.JMenuItem disqualifyRobotMI
          the MenuItem for disqualirfying a robot
private  javax.swing.JMenuItem endProgramMI
          the MenuItem for exiting the program
private  javax.swing.JMenu fileMenu
          the file menu
private  javax.swing.JMenu gameMenu
          the game menu
private  javax.swing.JMenuItem gameRulesMI
          the MenuItem for calling the frame with the rules fo the game
private  javax.swing.JMenu helpMenu
          the help menu
private  javax.swing.JSeparator jSeparator1
          a separator -- created by forte4java
private  javax.swing.JSeparator jSeparator2
          a separator -- created by forte4java
private  javax.swing.JSeparator jSeparator3
          a separator -- created by forte4java
private  javax.swing.JSeparator jSeparator4
          a separator -- created by forte4java
private  javax.swing.JSeparator jSeparator5
          a separator -- created by forte4java
private  javax.swing.JPanel leftStatusPanel
          the panel where the robotTree an the robotStatus is placed in
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.JMenuItem loadArenaStyleMI
          the MenuItem for loading a new ArenaStyle, that is new images for the items in the 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 static javax.swing.JFrame mainFrame
          The frame where the simulation will take place.
private  javax.swing.JMenuBar menubar
          the menubar of the frame
private  javax.swing.JMenuItem newGameMI
          the MenuItem for starting a new game
private  javax.swing.JMenu options
          the options menu
private  javax.swing.JPanel outerBottomStatusPanel
          the panel where the arena and the bottomStatusPanel is placed in
private  javax.swing.JCheckBoxMenuItem pauseAfterEveryRoundCMI
          the CheckBoxMenuItem for pausing the game after every round when it is set true
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  TriTree robotTree
          the tree where all robots are listed and the status of each is shown.
private  javax.swing.JScrollPane robotTreeScrollPane
          the ScrollPane where the robotTree is put in
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 setEnergyMI
          the MenuItem for setting the maximum energy
private  LastActionRobot.SetStatusLabel ssl
          The object of the class SetStatusLabel, which is stored in this variable to be able to stop the thread when a new one is created.
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  javax.swing.JLabel statusLabel
          the status label at the bottom of the frame for important messages during the game
private  LastActionRobot.StatusRobotComponent statusRobotComponent
          the component where the status of the robot is presented
private  javax.swing.JButton stopButton
          the button of the toolbar for stopping the game
private  int time
          The total playing time, always counting when the game is started.
private  javax.swing.JToolBar toolbar
          the toolbar
private  javax.swing.JMenuItem versionMI
          the MenuItem for calling the frame showing the current version
private  javax.swing.JCheckBoxMenuItem viewCutScenesCMI
          the CheckBoxMenuItem for viewing the CutScenes when it is set true
private  javax.swing.JMenu viewMenu
          the view menu
private  javax.swing.JCheckBoxMenuItem viewRobotStatusCMI
          the CheckBoxMenuItem for viewing the robot status when it is set true
private  javax.swing.JCheckBoxMenuItem viewRobotTreeCMI
          the CheckBoxMenuItem for viewing the tree of robots when it is set true
private  javax.swing.JCheckBoxMenuItem viewStatusBarCMI
          the CheckBoxMenuItem for viewing the status bar at the bottom when it is set true
private  int zoomBottomBorder
          the bottom border for the zoom factor, 20 by default
private  javax.swing.JMenuItem zoomInMI
          the MenuItem for zooming into the arena
private  javax.swing.JMenuItem zoomOutMI
          the MenuItem for zooming out of the arena
private  int zoomStep
          the step from one zoom-resolution to the previous or the next, 0 by default
private  int zoomTopBorder
          the top border for the zoom factor, 20 by default
 
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
LastActionRobot()
          Creates a new instance of LastActionRobot
 
Method Summary
private  void constructArena(javax.swing.JPanel arenaPanel)
          Creates components for the arena fields, adds the components to the GUI and links them to the fields.
private  java.util.Vector createNames(java.io.File[] files)
          This method returns from an array of files all the filenames that don't match with "CVS" or "arena.style".
 void cutSceneController()
          Method to call the controller of the CutScenes.
 void deleteRobot()
          opens a frame which shows a list of all the robots the user may choose which robot to delete
 void disqualify(Robot robot)
          Method to gain access to the CutScene when one robot has to be disqualified.
 void disqualifyRobot()
          opens a frame which shows a list of all the bad robots the user may choose which robot to disqualify
private  void endProgram(java.awt.event.ActionEvent e)
          exits the programm when endProgramMI is selected.
private  void exitForm(java.awt.event.WindowEvent evt)
          Exit the Application
 Arena getArena()
          Returns a reference to the arena object used by this class.
 ArenaImages getArenaImages()
          Returns a reference to the image set currently used.
 int getArenaSize()
          returns the arenaSize, that is nearly the size of each arena image.
 boolean getPauseAfterEveryRound()
          returns whether the "Pause nach jeder Spielrunde" CMI is set or not
private  void initComponents()
          This method is called from within the constructor to initialize the form.
private  void initializeArenaGUI()
          Initializes the arena GUI elements using the datastructures of arena.
 boolean isTreeVisible()
          method to test, if the tree on the left hand side of the window is visible.
private  void loadArena()
          Asks the user to select an arena layout and loads and displays it.
private  void loadArenaStyle()
          By this method it is now possible to load different arena styles, i. e. different graphical representations.
private  void loadArenaStyleFileChooser(java.lang.String str)
          If the file arena.style is not in the folder where it has necessarily to be, you have to search for the folder, where this file is in, for yourself.
private  void loadArenaStyleList(java.util.Vector names)
          Method implemented to create a new instance of an ArenaStyleChooser.
private  void loadRobot()
          Method to load robot files by a JFileChooser
 void loadRobotList()
          Method to load robots from from a list by a JFileChooser.
static void main(java.lang.String[] args)
          The main method called when the program begins to run.
 void noEnergy(Robot robot)
          Method to gain access to the CutScene when one robot has run out of energy.
private  void pauseResume()
          this method pauses the game or resumes it.
private  void robotImageUpdate()
          method to update the robot images.
 void saveRobotList()
          method to save all the robots that are in the iterator to a file.
private  void setEnergyBox()
          this method will change the default energy (400)
 void setPauseButton(boolean value)
          method to update the icon of the pauseButton.
 void setStatusLabel(java.lang.String string)
          method to gain acces to the bottom statusLabel.
 void showNoStatusRobot()
          Called by the RobotTimer to disable the view of the statusrobot and change back to the general view.
private  void showRobotStatus()
          show or hide the RobotStatus
private  void showRobotTree()
          show or hide the robotTree
private  void showStatusBar()
          show or hide the StatusBar
 void showStatusRobot(Robot robot, long time)
          Called by the RobotTimer to transmit the current acting robot and the time he has needed IN THIS ROUND (not on the whole).
private  void start()
          This method starts the game.
 void stop()
          Method to stop the game.
 void stopButtonUpdate()
          Method to set the Buttons into the "Stop-Mode".
 void swapCardsBoth(Robot robot1, Robot robot2)
          Method to gain access to the CutScene when both robots want to swap cards.
 void swapCardsOne(Robot swapRobot, Robot noSwapRobot)
          Method to gain access to the CutScene when one. robot want to swap cards and the other doesn't.
 void updateRobotTree(RobotData[] robotDat)
          Updates the robotTree when needed.
 void victory(Robot robot)
          Method to gain access to the CutScene when one robot has one.
private  void zoomIn()
          Method to zoom into the arena when possible.
private  void zoomOut()
          Method to zoom out of the arena when possible.
 
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

mainFrame

private static javax.swing.JFrame mainFrame
The frame where the simulation will take place.

zoomStep

private int zoomStep
the step from one zoom-resolution to the previous or the next, 0 by default

zoomBottomBorder

private int zoomBottomBorder
the bottom border for the zoom factor, 20 by default

zoomTopBorder

private int zoomTopBorder
the top border for the zoom factor, 20 by default

arenaSize

private int arenaSize
the current arena size, that is nearly the size of each arena image. For example, when the image has a size of 20x20 arenaSize contains the value 20. The arena size depends on the folder the images are placed in. It is NOT the exact value of each field.

currentDir

private java.lang.String currentDir
the current directory of the arena.

time

private int time
The total playing time, always counting when the game is started.

menubar

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

fileMenu

private javax.swing.JMenu fileMenu
the file menu

newGameMI

private javax.swing.JMenuItem newGameMI
the MenuItem for starting a new game

jSeparator1

private javax.swing.JSeparator jSeparator1
a separator -- created by forte4java

loadArenaMI

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

jSeparator2

private javax.swing.JSeparator jSeparator2
a separator -- created by forte4java

loadRobotMI

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

deleteRobotMI

private javax.swing.JMenuItem deleteRobotMI
the MenuItem for delteing 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

jSeparator3

private javax.swing.JSeparator jSeparator3
a separator -- created by forte4java

disqualifyRobotMI

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

jSeparator4

private javax.swing.JSeparator jSeparator4
a separator -- created by forte4java

endProgramMI

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

gameMenu

private javax.swing.JMenu gameMenu
the game menu

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

pauseAfterEveryRoundCMI

private javax.swing.JCheckBoxMenuItem pauseAfterEveryRoundCMI
the CheckBoxMenuItem for pausing the game after every round when it is set true

viewMenu

private javax.swing.JMenu viewMenu
the view menu

viewRobotStatusCMI

private javax.swing.JCheckBoxMenuItem viewRobotStatusCMI
the CheckBoxMenuItem for viewing the robot status when it is set true

viewRobotTreeCMI

private javax.swing.JCheckBoxMenuItem viewRobotTreeCMI
the CheckBoxMenuItem for viewing the tree of robots when it is set true

viewStatusBarCMI

private javax.swing.JCheckBoxMenuItem viewStatusBarCMI
the CheckBoxMenuItem for viewing the status bar at the bottom when it is set true

viewCutScenesCMI

private javax.swing.JCheckBoxMenuItem viewCutScenesCMI
the CheckBoxMenuItem for viewing the CutScenes when it is set true

zoomInMI

private javax.swing.JMenuItem zoomInMI
the MenuItem for zooming into the arena

zoomOutMI

private javax.swing.JMenuItem zoomOutMI
the MenuItem for zooming out of the arena

options

private javax.swing.JMenu options
the options menu

loadArenaStyleMI

private javax.swing.JMenuItem loadArenaStyleMI
the MenuItem for loading a new ArenaStyle, that is new images for the items in the arena

setEnergyMI

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

arenaDesignerMI

private javax.swing.JMenuItem arenaDesignerMI
the MenuItem for starting the arenaDesigner

helpMenu

private javax.swing.JMenu helpMenu
the help menu

versionMI

private javax.swing.JMenuItem versionMI
the MenuItem for calling the frame showing the current version

creditsMI

private javax.swing.JMenuItem creditsMI
the MenuItem for calling the frame showing the credits

jSeparator5

private javax.swing.JSeparator jSeparator5
a separator -- created by forte4java

gameRulesMI

private javax.swing.JMenuItem gameRulesMI
the MenuItem for calling the frame with the rules fo the game

leftStatusPanel

private javax.swing.JPanel leftStatusPanel
the panel where the robotTree an the robotStatus is placed in

statusRobotComponent

private LastActionRobot.StatusRobotComponent statusRobotComponent
the component where the status of the robot is presented

robotTreeScrollPane

private javax.swing.JScrollPane robotTreeScrollPane
the ScrollPane where the robotTree is put in

bottomStatusPanel

private javax.swing.JPanel bottomStatusPanel
the panel where the status label at the bottom is placed in

statusLabel

private javax.swing.JLabel statusLabel
the status label at the bottom of the frame for important messages during the game

arenaPanel

private javax.swing.JPanel arenaPanel
the panel where the arena is placed in

toolbar

private javax.swing.JToolBar toolbar
the toolbar

outerBottomStatusPanel

private javax.swing.JPanel outerBottomStatusPanel
the panel where the arena and the bottomStatusPanel is placed in

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

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

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

arena

private Arena arena
our little, cute arena

arenaScrollPane

private javax.swing.JScrollPane arenaScrollPane
the ScrollPane where the arena is placed in

cutScenesMI

private javax.swing.JMenuItem cutScenesMI
the MenuItem for changing the modalities of the CutScenes

arenaImages

private ArenaImages arenaImages
the images for the arena field items

robotTree

private TriTree robotTree
the tree where all robots are listed and the status of each is shown.

cut

CutScene cut
The object for the CutScenes

ssl

private LastActionRobot.SetStatusLabel ssl
The object of the class SetStatusLabel, which is stored in this variable to be able to stop the thread when a new one is created.
Constructor Detail

LastActionRobot

public LastActionRobot()
Creates a new instance of LastActionRobot
Method Detail

initComponents

private void initComponents()
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the FormEditor.


getPauseAfterEveryRound

public boolean getPauseAfterEveryRound()
returns whether the "Pause nach jeder Spielrunde" CMI is set or not

exitForm

private void exitForm(java.awt.event.WindowEvent evt)
Exit the Application

main

public static void main(java.lang.String[] args)
The main method called when the program begins to run.
Parameters:
args - the command line arguments

endProgram

private void endProgram(java.awt.event.ActionEvent e)
exits the programm when endProgramMI is selected.

initializeArenaGUI

private void initializeArenaGUI()
Initializes the arena GUI elements using the datastructures of arena. Calls the robotImageUpdate() method as well.

robotImageUpdate

private void robotImageUpdate()
method to update the robot images.

loadArena

private void loadArena()
Asks the user to select an arena layout and loads and displays it.

updateRobotTree

public void updateRobotTree(RobotData[] robotDat)
Updates the robotTree when needed.

constructArena

private void constructArena(javax.swing.JPanel arenaPanel)
Creates components for the arena fields, adds the components to the GUI and links them to the fields.

Parameters:
arenaPanel - The panel, where the arena is put in.

start

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

setPauseButton

public void setPauseButton(boolean value)
method to update the icon of the pauseButton.

Parameters:
value - true when the arena is paused, false otherwise.

pauseResume

private void pauseResume()
this method pauses the game or resumes it.

stop

public void stop()
Method to stop the game.

stopButtonUpdate

public void stopButtonUpdate()
Method to set the Buttons into the "Stop-Mode".

showRobotStatus

private void showRobotStatus()
show or hide the RobotStatus

showRobotTree

private void showRobotTree()
show or hide the robotTree

showStatusBar

private void showStatusBar()
show or hide the StatusBar

loadArenaStyle

private void loadArenaStyle()
By this method it is now possible to load different arena styles, i. e. different graphical representations.

createNames

private java.util.Vector createNames(java.io.File[] files)
This method returns from an array of files all the filenames that don't match with "CVS" or "arena.style".

Parameters:
files - The array of files.
Returns:
A vector with the names of the files. If there aren't any names, an empty vector (not null) will be returned.

loadArenaStyleFileChooser

private void loadArenaStyleFileChooser(java.lang.String str)
If the file arena.style is not in the folder where it has necessarily to be, you have to search for the folder, where this file is in, for yourself. Also you have to search for the folder, when the file "arena.style" is in an empty folder.

Parameters:
str - The string that is shown in the JOptionPane. If it is null, the default text is shown.

loadArenaStyleList

private void loadArenaStyleList(java.util.Vector names)
Method implemented to create a new instance of an ArenaStyleChooser.

Parameters:
names - The vector containing the names of the folders, where the new arena styles are in.

loadRobot

private void loadRobot()
Method to load robot files by a JFileChooser

saveRobotList

public void saveRobotList()
method to save all the robots that are in the iterator to a file.

loadRobotList

public void loadRobotList()
Method to load robots from from a list by a JFileChooser.

zoomIn

private void zoomIn()
Method to zoom into the arena when possible.

zoomOut

private void zoomOut()
Method to zoom out of the arena when possible.

cutSceneController

public void cutSceneController()
Method to call the controller of the CutScenes. The controller is a frame where you can select which CutScenes shall be shown.

setEnergyBox

private void setEnergyBox()
this method will change the default energy (400)

setStatusLabel

public void setStatusLabel(java.lang.String string)
method to gain acces to the bottom statusLabel.

Parameters:
string - The new String for the statusLabel

getArena

public Arena getArena()
Returns a reference to the arena object used by this class.

Returns:
arena used by this class

getArenaImages

public ArenaImages getArenaImages()
Returns a reference to the image set currently used.

Returns:
image set that is in use

deleteRobot

public void deleteRobot()
opens a frame which shows a list of all the robots the user may choose which robot to delete

disqualifyRobot

public void disqualifyRobot()
opens a frame which shows a list of all the bad robots the user may choose which robot to disqualify

getArenaSize

public int getArenaSize()
returns the arenaSize, that is nearly the size of each arena image. For example, when the image has a size of 20x20 arenaSize contains the value 20. The arena size depends on the folder the images are placed in. It is NOT the exact value of each field.

Returns:
the arenaSize.

isTreeVisible

public boolean isTreeVisible()
method to test, if the tree on the left hand side of the window is visible.

Returns:
true, if the tree is visible, false otherwise.

showStatusRobot

public void showStatusRobot(Robot robot,
                            long time)
Called by the RobotTimer to transmit the current acting robot and the time he has needed IN THIS ROUND (not on the whole).

Parameters:
robot - the currently acting robot.
time - the time the robot needed in this round so far.

showNoStatusRobot

public void showNoStatusRobot()
Called by the RobotTimer to disable the view of the statusrobot and change back to the general view.

swapCardsBoth

public void swapCardsBoth(Robot robot1,
                          Robot robot2)
Method to gain access to the CutScene when both robots want to swap cards.

Parameters:
robot1 - The first robot that wants to swap cards
robot2 - The second robot that wants to swap cards.

swapCardsOne

public void swapCardsOne(Robot swapRobot,
                         Robot noSwapRobot)
Method to gain access to the CutScene when one. robot want to swap cards and the other doesn't.

Parameters:
swapRobot - The robot that wants to swap cards.
noSwapRobot - the robot that doesn't want to swap cards.

noEnergy

public void noEnergy(Robot robot)
Method to gain access to the CutScene when one robot has run out of energy.

Parameters:
robot - The robot with no energy.

disqualify

public void disqualify(Robot robot)
Method to gain access to the CutScene when one robot has to be disqualified.

Parameters:
robot - The robot that has to be disqualified.

victory

public void victory(Robot robot)
Method to gain access to the CutScene when one robot has one.

Parameters:
robot - The robot that has one the game.