|
|||||||||
| 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
|
+--java.awt.Window
|
+--java.awt.Frame
|
+--javax.swing.JFrame
|
+--de.uni_paderborn.robots.gui.ArenaFrame
Main window of the game.
| 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 |
|
| 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 |
private Arena arena
private ArenaCanvas arenaCanvas
private StatisticPanel statisticPanel
private DebugWindow debugWindow
private Fields lastFields
private boolean isBlocked
private javax.swing.JMenuBar menubar
private javax.swing.JMenu fileMenu
private javax.swing.JMenuItem loadArenaMI
private javax.swing.JMenuItem saveArenaMI
private javax.swing.JMenuItem loadRobotMI
private javax.swing.JMenuItem deleteRobotMI
private javax.swing.JMenuItem saveRobotListMI
private javax.swing.JMenuItem loadRobotListMI
private javax.swing.JMenuItem disqualifyRobotMI
private javax.swing.JMenuItem endProgramMI
private javax.swing.JMenu gameMenu
private javax.swing.JMenuItem resetMI
private javax.swing.JMenuItem startStopMI
private javax.swing.JMenuItem pauseResumeMI
private javax.swing.JCheckBoxMenuItem debugModeCMI
private javax.swing.JMenuItem stepMI
private javax.swing.JMenu viewMenu
private javax.swing.JCheckBoxMenuItem zoomMI
private javax.swing.JMenu optionsMenu
private javax.swing.JMenuItem setEnergyMI
private javax.swing.JMenuItem setDelayMI
private javax.swing.JMenuItem setRechargerMI
private javax.swing.JMenuItem setPunishmentMI
private javax.swing.JMenuItem startArenaDesignerMI
private javax.swing.JMenu helpMenu
private javax.swing.JMenuItem aboutMI
private javax.swing.JMenuItem helpMI
private javax.swing.JToolBar toolbar
private javax.swing.JButton loadArenaButton
private javax.swing.JButton loadRobotButton
private javax.swing.JButton deleteRobotButton
private javax.swing.JButton loadRobotListButton
private javax.swing.JButton saveRobotListButton
private javax.swing.JButton resetButton
private javax.swing.JButton startButton
private javax.swing.JButton pauseButton
private javax.swing.JButton stopButton
private javax.swing.JButton disqualifyButton
private javax.swing.JButton debugButton
private javax.swing.JButton stepButton
private javax.swing.JButton quitButton
private javax.swing.ImageIcon pauseIcon
private javax.swing.ImageIcon continueIcon
private javax.swing.JScrollPane jScrollPane
private boolean gameRunning
private boolean gameActive
private boolean automaticPaused
private javax.swing.JLabel clockLabel
private ArenaFrame.GameTime gameTime
private javax.swing.JLabel turnNumberLabel
| Constructor Detail |
public ArenaFrame()
| Method Detail |
private boolean loadArena(java.io.File file)
file - a local fileprivate boolean saveArena(java.io.File file)
file - a local fileprivate void initComponents()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the ActionEventpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenere - the KeyEvent.public void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenere - the KeyEvent.public void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenere - the KeyEvent.public void block(boolean on)
on - true, if event handling blocker should be turned on, false if notpublic ArenaCanvas getArenaCanvas()
public StatisticPanel getStatisticPanel()
public Arena getArena()
private void loadArena()
private void saveArena()
private void resetGame()
private void startGame()
private void pauseGame()
private void resumeGame()
private void stopGame()
private boolean checkRobotClass(java.lang.Class clazz)
clazz - the Class object
private RobotFunctions loadRobotClass(java.io.File file,
boolean check)
file - the class file to load.check - true, if we are in check mode onlyprivate void loadRobot()
private java.lang.String getRobotName(RobotFunctions robotFunctions)
robotFunctions - the object implementing RobotFunctionspublic void checkRobotNumber()
private void saveRobotList()
private void loadRobotList()
private void setEnergyBox()
private void setRechargerBox()
private void setPunishmentBox()
private void setDelayBox()
private void deleteRobot()
private void disqualifyRobot(Robot robot)
robot - the robot to choose by default in the dialog, null, if no robot is to be chosen
public void showRanking(java.lang.String message,
Robot[] robots,
int[] points)
message - the message to be shown before showing the ranking, if null no message is displayedrobots - the robots given in ranking orderpoints - the points of the robots given in ranking order
public void disqualificationDialog(java.lang.String message,
Robot robot)
message - the message to be shown before showing the rankingrobot - the robot to choose by default in the dialog, null, if no robot is to be chosenpublic void printDebugMessage(java.lang.String message)
message - message to be displayed in debug windowpublic void showMessage(java.lang.String message)
message - the message to be shownpublic void setActualTurnNo(int turnNo)
public void clearDebugWindow()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||