de.uni_paderborn.robots.gui
Class ArenaDesignerFrame

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

public class ArenaDesignerFrame
extends javax.swing.JFrame

this class creates the main frame for the Arena designer

See Also:
Serialized Form

Inner Class Summary
private  class ArenaDesignerFrame.LoadArenaFileFilter
          The FileFilter for loading the arena, thus only files ending with ".arena" are shown.
 
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  java.io.File actualFile
          contains the actual filename
private  boolean allTeleportersOrdered
          true if all teleporters are ordered
private  boolean arenaChanged
          is true when the arena has changed
private  javax.swing.JButton[][] buttonArray
          the array which contains all buttons
private  int[][] contentArray
          the array which contains the current arena
private  java.lang.String energyIcon
          the name of the file for a energy-Icon
private  java.lang.String exitIcon
          the name of the file for a exit-Icon
private  boolean exitSet
          if there is an exit in the arena it is true
private  java.lang.String fieldIcon
          the name of the file for a field-Icon
private  int height
          the height of the current arena
private  javax.swing.JMenuBar jMenuBar
          the menu bar
private  javax.swing.JMenu jMenuFile
          the file menu
private  javax.swing.JMenu jMenuInfo
          the info menu
private  javax.swing.JMenuItem jMenuItemAbout
          the about MI in the info menu
private  javax.swing.JMenuItem jMenuItemNewArena
          new arena MI in file menu
private  javax.swing.JMenuItem jMenuItemOpenArena
          open arena MI in file menu
private  javax.swing.JMenuItem jMenuItemOrder
          the order teleporter MI in the teleporter menu
private  javax.swing.JMenuItem jMenuItemQuit
          exit arena designer MI in file menu
private  javax.swing.JMenuItem jMenuItemSaveArena
          save arena MI in file menu
private  javax.swing.JMenuItem jMenuItemSaveArenaAs
          save arena as MI in file menu
private  javax.swing.JMenuItem jMenuItemStopOrder
          the stop order teleporter MI in the teleporter menu
private  javax.swing.JMenu jMenuTeleporter
          the teleporter menu
private  javax.swing.JPanel jPanel
          the panel containing the buttons
private  javax.swing.JScrollPane jScrollPane
          the scroll panel containing the jPanel
private  javax.swing.JSeparator jSeparator1
          a seperator
private  javax.swing.JSeparator jSeparator2
          a seperator
private  javax.swing.JSeparator jSeparator3
          a seperator
private  java.lang.String robotIcon
          the name of the file for a robot-Icon
private  java.awt.Dimension screenSize
          the screen size
private  java.lang.String startImage
          the name of the file for the introducing-Icon
private  int[][] teleporterArray
          the array which contains all teleporter numbers
private  java.lang.String teleporterIcon
          the name of the file for a teleporter-Icon
private  boolean teleporterMode
          true when order teleporter is selected, important for the listener
private  int[][] useASCIIForTeleporterArray
          the array which contains the free ascii-chars for teleporters
private  java.lang.String wallIcon
          the name of the file for a wall-Icon
private  int width
          the width of the current arena
 
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, 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, 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
ArenaDesignerFrame()
          Creates new form ArenaDesignerFrame
 
Method Summary
private  void checkIfTeleportersAreOrdered()
          method is called to check if all teleporters are ordered
private  void exitForm(java.awt.event.WindowEvent evt)
          method is called to exit the frame
 int getHeight()
          method is called to get the height of the arena
 int getWidth()
          method is called to get the width of the arena
private  void initComponents()
          This method is called from within the constructor to initialize the GUI-form.
 void initializeArray()
          method is called to initialize the teleporter arrays
 void initializeButtons()
          method is called to initialize the buttons such as they are in the content array
private  void jMenuItemAboutActionPerformed(java.awt.event.ActionEvent evt)
          creates and shows a new about frame
private  void jMenuItemNewArenaActionPerformed(java.awt.event.ActionEvent evt)
          method is called when you select the new arena MI checks whether the old arena has changed and opens a dialog to create a new arena
private  void jMenuItemOpenArenaActionPerformed(java.awt.event.ActionEvent evt)
          method is called when you select the open arena MI checks whether the old arena has changed and opens a dialog to open a new arena
private  void jMenuItemOrderActionPerformed(java.awt.event.ActionEvent evt)
          this method is called when the order teleporter MI is selected all button which are no teleporters will be disabled and if the number of the teleporter is known it will be displayed on it
private  void jMenuItemQuitActionPerformed(java.awt.event.ActionEvent evt)
          method is called when you select the quit MI
private  void jMenuItemSaveArenaActionPerformed(java.awt.event.ActionEvent evt)
          method is called when you select the save arena MI checks whether the arena name is not equal to untiteled.arena, checks for unselected teleporters and saves the arena
private  void jMenuItemSaveArenaAsActionPerformed(java.awt.event.ActionEvent evt)
          method is called when you select the save arena as MI checks whether the arena has unselected teleporters and opens a dialog to save the arena as
private  void jMenuItemStopOrderActionPerformed(java.awt.event.ActionEvent evt)
          Method is performed when the stop order teleporters MI is selected
 void saveArena(java.io.File fileName)
          method is called to save the current arena to file
 void setHeight(int value)
          method is called to set the height of the arena
 void setWidth(int value)
          method is called to set the width of the arena
 
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, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, 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

buttonArray

private javax.swing.JButton[][] buttonArray
the array which contains all buttons

teleporterArray

private int[][] teleporterArray
the array which contains all teleporter numbers

contentArray

private int[][] contentArray
the array which contains the current arena

fieldIcon

private java.lang.String fieldIcon
the name of the file for a field-Icon

wallIcon

private java.lang.String wallIcon
the name of the file for a wall-Icon

teleporterIcon

private java.lang.String teleporterIcon
the name of the file for a teleporter-Icon

exitIcon

private java.lang.String exitIcon
the name of the file for a exit-Icon

robotIcon

private java.lang.String robotIcon
the name of the file for a robot-Icon

energyIcon

private java.lang.String energyIcon
the name of the file for a energy-Icon

startImage

private java.lang.String startImage
the name of the file for the introducing-Icon

actualFile

private java.io.File actualFile
contains the actual filename

exitSet

private boolean exitSet
if there is an exit in the arena it is true

arenaChanged

private boolean arenaChanged
is true when the arena has changed

teleporterMode

private boolean teleporterMode
true when order teleporter is selected, important for the listener

allTeleportersOrdered

private boolean allTeleportersOrdered
true if all teleporters are ordered

screenSize

private java.awt.Dimension screenSize
the screen size

useASCIIForTeleporterArray

private int[][] useASCIIForTeleporterArray
the array which contains the free ascii-chars for teleporters

jMenuBar

private javax.swing.JMenuBar jMenuBar
the menu bar

jMenuFile

private javax.swing.JMenu jMenuFile
the file menu

jMenuItemNewArena

private javax.swing.JMenuItem jMenuItemNewArena
new arena MI in file menu

jSeparator1

private javax.swing.JSeparator jSeparator1
a seperator

jMenuItemOpenArena

private javax.swing.JMenuItem jMenuItemOpenArena
open arena MI in file menu

jSeparator2

private javax.swing.JSeparator jSeparator2
a seperator

jMenuItemSaveArena

private javax.swing.JMenuItem jMenuItemSaveArena
save arena MI in file menu

jMenuItemSaveArenaAs

private javax.swing.JMenuItem jMenuItemSaveArenaAs
save arena as MI in file menu

jSeparator3

private javax.swing.JSeparator jSeparator3
a seperator

jMenuItemQuit

private javax.swing.JMenuItem jMenuItemQuit
exit arena designer MI in file menu

jMenuTeleporter

private javax.swing.JMenu jMenuTeleporter
the teleporter menu

jMenuItemOrder

private javax.swing.JMenuItem jMenuItemOrder
the order teleporter MI in the teleporter menu

jMenuItemStopOrder

private javax.swing.JMenuItem jMenuItemStopOrder
the stop order teleporter MI in the teleporter menu

jMenuInfo

private javax.swing.JMenu jMenuInfo
the info menu

jMenuItemAbout

private javax.swing.JMenuItem jMenuItemAbout
the about MI in the info menu

jPanel

private javax.swing.JPanel jPanel
the panel containing the buttons

jScrollPane

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

width

private int width
the width of the current arena

height

private int height
the height of the current arena
Constructor Detail

ArenaDesignerFrame

public ArenaDesignerFrame()
Creates new form ArenaDesignerFrame
Method Detail

initComponents

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

jMenuItemStopOrderActionPerformed

private void jMenuItemStopOrderActionPerformed(java.awt.event.ActionEvent evt)
Method is performed when the stop order teleporters MI is selected
Parameters:
evt - the ActionEvent

jMenuItemAboutActionPerformed

private void jMenuItemAboutActionPerformed(java.awt.event.ActionEvent evt)
creates and shows a new about frame
Parameters:
evt - the ActionEvent

jMenuItemOrderActionPerformed

private void jMenuItemOrderActionPerformed(java.awt.event.ActionEvent evt)
this method is called when the order teleporter MI is selected all button which are no teleporters will be disabled and if the number of the teleporter is known it will be displayed on it
Parameters:
evt - the ActionEvent

jMenuItemQuitActionPerformed

private void jMenuItemQuitActionPerformed(java.awt.event.ActionEvent evt)
method is called when you select the quit MI
Parameters:
evt - the ActionEvent

jMenuItemSaveArenaAsActionPerformed

private void jMenuItemSaveArenaAsActionPerformed(java.awt.event.ActionEvent evt)
method is called when you select the save arena as MI checks whether the arena has unselected teleporters and opens a dialog to save the arena as
Parameters:
evt - the ActionEvent

jMenuItemSaveArenaActionPerformed

private void jMenuItemSaveArenaActionPerformed(java.awt.event.ActionEvent evt)
method is called when you select the save arena MI checks whether the arena name is not equal to untiteled.arena, checks for unselected teleporters and saves the arena
Parameters:
evt - the ActionEvent

jMenuItemOpenArenaActionPerformed

private void jMenuItemOpenArenaActionPerformed(java.awt.event.ActionEvent evt)
method is called when you select the open arena MI checks whether the old arena has changed and opens a dialog to open a new arena
Parameters:
evt - the ActionEvent

jMenuItemNewArenaActionPerformed

private void jMenuItemNewArenaActionPerformed(java.awt.event.ActionEvent evt)
method is called when you select the new arena MI checks whether the old arena has changed and opens a dialog to create a new arena
Parameters:
evt - the ActionEvent

initializeArray

public void initializeArray()
method is called to initialize the teleporter arrays

initializeButtons

public void initializeButtons()
method is called to initialize the buttons such as they are in the content array

exitForm

private void exitForm(java.awt.event.WindowEvent evt)
method is called to exit the frame

setWidth

public void setWidth(int value)
method is called to set the width of the arena
Parameters:
value - the new width

getWidth

public int getWidth()
method is called to get the width of the arena
Overrides:
getWidth in class java.awt.Component
Returns:
the current width

setHeight

public void setHeight(int value)
method is called to set the height of the arena
Parameters:
value - the height

getHeight

public int getHeight()
method is called to get the height of the arena
Overrides:
getHeight in class java.awt.Component
Returns:
the current height

checkIfTeleportersAreOrdered

private void checkIfTeleportersAreOrdered()
method is called to check if all teleporters are ordered

saveArena

public void saveArena(java.io.File fileName)
method is called to save the current arena to file
Parameters:
fileName - the filename for the arena