Class WorldBuilder

  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by alice.kareltherobot.WorldBuilder
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class WorldBuilder
extends javax.swing.JFrame

A world builder is a dialog with facilities for manipulating all aspects of a world. You can use it to place (and remove) beepers and walls. Additionally you can use a world builder to save or restore a world from a file. Closing a world builder window exits the application. You can zoom the camera in and out with the right and left arrow keys (after clicking on the background).

There are two command line arguments possible. The first is an integer that sets the number of streets and avenues on which items may be placed (default = 20). If the second (or the first if the size isn't specified) is the word "tracing" then the world builder will print, on System.out, a transcript of the actions you take.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Field Summary
Fields inherited from class javax.swing.JFrame
Fields inherited from class java.awt.Frame
Fields inherited from class java.awt.Component
Fields inherited from interface javax.swing.WindowConstants
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
WorldBuilder(int numberOfStreets)
          Create a world builder with a given number of streets and avenues available as targets at which to place beepers and walls.
Method Summary
static void main(java.lang.String[] args)
          Run the world builder to accept builder commands The default world size is 20 by 20.
 void setTracing(boolean trace)
          Set the world builder to trace its actions to System.out or not.
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent

Constructor Detail


public WorldBuilder(int numberOfStreets)
Create a world builder with a given number of streets and avenues available as targets at which to place beepers and walls. The targets are at the corners and show a small blue squares. Outside this marked region, mouse clicks are not effective.

Select a tool from the tool menu and then click in the world window at a target. The beeper tool will place a beeper at the corner for each click. If there is already a beeper on the corner you can't see the target, so click the existing beeper instead.

The East-West wall tool will place a wall segment north of the corner on which you click. The North-South wall tool will place a wall segment east of the corner.

When a tool is selected, it may be de-selected with the space bar. When a tool is selected you may select the remove tool by typing "R".

When the beeper tool is selected you may select the infinite-beepers tool by typing "I".

numberOfStreets - the number of streets and avenues marked for dropping components
Method Detail


public void setTracing(boolean trace)
Set the world builder to trace its actions to System.out or not. False by default.

trace - if true, the builder will trace its actions.


public static void main(java.lang.String[] args)
Run the world builder to accept builder commands The default world size is 20 by 20. You can change this with a command line argument, but note that a large number of streets may put a heavy load on your computer. 40 by 40 creates 1600 additional objects to serve as targets for mouse clicks. A large number slows down the operation and you may run out of memory as well.

args - arg[0] is the size of the world in streets with an equal number of avenues