java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.livingpaper.hansa.HansaWindow
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
- public class HansaWindow
- extends javax.swing.JFrame
- implements java.awt.event.ActionListener
Hansa is the main class and main window of the Hansa application,
the window that displays the map and handles player interaction
with the game.
| Nested classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
| Nested classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
| Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
|
Constructor Summary |
HansaWindow(GameModel model)
The Hansa constructor creates and lays out the main window,
and populates it with a map, cities, and the city and trade
information panes. |
| Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getPreferredSize, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.awt.Frame |
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.awt.Window |
addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getGraphicsConfiguration, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
kVersionString
private static final java.lang.String kVersionString
- See Also:
- Constant Field Values
mScrollPane
private javax.swing.JScrollPane mScrollPane
mTabbedPane
private javax.swing.JTabbedPane mTabbedPane
mCityPanel
private javax.swing.JPanel mCityPanel
mTradePanel
private javax.swing.JPanel mTradePanel
mMapView
private MapView mMapView
mCityPortInfoLabel
private javax.swing.JLabel mCityPortInfoLabel
mCityInfoLabel
private javax.swing.JLabel mCityInfoLabel
mCityUtilityBar
private javax.swing.JProgressBar mCityUtilityBar
mCityPopulationBar
private javax.swing.JProgressBar mCityPopulationBar
mCityLaborBar
private javax.swing.JProgressBar mCityLaborBar
mCityProductionBox
private javax.swing.JPanel mCityProductionBox
mWheatProductionSlider
private javax.swing.JSlider mWheatProductionSlider
mFishProductionSlider
private javax.swing.JSlider mFishProductionSlider
mIronProductionSlider
private javax.swing.JSlider mIronProductionSlider
mSilkProductionSlider
private javax.swing.JSlider mSilkProductionSlider
mStatusPanel
private javax.swing.JPanel mStatusPanel
mMessageLabel
private javax.swing.JLabel mMessageLabel
mTurnButton
private javax.swing.JButton mTurnButton
mDefaultStroke
private java.awt.BasicStroke mDefaultStroke
mHaloStroke
private java.awt.BasicStroke mHaloStroke
mGameTypeDialog
private GameTypeDialog mGameTypeDialog
mNewLocalGameDialog
private NewLocalGameDialog mNewLocalGameDialog
mMaxWidth
private int mMaxWidth
mMaxHeight
private int mMaxHeight
mTabbedPaneWidth
private int mTabbedPaneWidth
mWindowWidthPad
private int mWindowWidthPad
mWindowHeightPad
private int mWindowHeightPad
mScreenWidthPad
private int mScreenWidthPad
mScreenHeightPad
private int mScreenHeightPad
mModel
private GameModel mModel
mDragSource
private java.awt.Point mDragSource
mLastDragPoint
private java.awt.Point mLastDragPoint
mainMenuBar
static final javax.swing.JMenuBar mainMenuBar
fileMenu
static final javax.swing.JMenu fileMenu
miNew
protected javax.swing.JMenuItem miNew
miOpen
protected javax.swing.JMenuItem miOpen
miClose
protected javax.swing.JMenuItem miClose
miSave
protected javax.swing.JMenuItem miSave
miSaveAs
protected javax.swing.JMenuItem miSaveAs
miQuit
protected javax.swing.JMenuItem miQuit
editMenu
static final javax.swing.JMenu editMenu
miUndo
protected javax.swing.JMenuItem miUndo
miCut
protected javax.swing.JMenuItem miCut
miCopy
protected javax.swing.JMenuItem miCopy
miPaste
protected javax.swing.JMenuItem miPaste
miClear
protected javax.swing.JMenuItem miClear
miSelectAll
protected javax.swing.JMenuItem miSelectAll
mAddressLabel
private javax.swing.JLabel mAddressLabel
mPortLabel
private javax.swing.JLabel mPortLabel
mAddressField
private javax.swing.JTextField mAddressField
mPortField
private javax.swing.JTextField mPortField
mConnectButton
private javax.swing.JButton mConnectButton
mStatusField
private javax.swing.JLabel mStatusField
mDisconnectButton
private javax.swing.JButton mDisconnectButton
toolsMenu
static final javax.swing.JMenu toolsMenu
miProductionWindow
protected javax.swing.JMenuItem miProductionWindow
miTradeWindow
protected javax.swing.JMenuItem miTradeWindow
HansaWindow
public HansaWindow(GameModel model)
- The Hansa constructor creates and lays out the main window,
and populates it with a map, cities, and the city and trade
information panes. It also sets up event handlers in the
map view that enable players to interact with the map.
addFileMenuItems
public void addFileMenuItems()
- Sets up the appplication's File menu.
addEditMenuItems
public void addEditMenuItems()
- Sets up the appllication's Edit menu items.
addToolsMenuItems
public void addToolsMenuItems()
- Sets up the application's Tools menu items.
addMenus
public void addMenus()
- Adds the application's menus to its interface.
paint
public void paint(java.awt.Graphics g)
- Draws the Hansa window contents
getModel
public GameModel getModel()
getMapView
public MapView getMapView()
getCityPortInfoLabel
public javax.swing.JLabel getCityPortInfoLabel()
statusMessage
public void statusMessage(java.lang.String message)
- Displays a status message in the label at the bottom of
the main window.
statusMessage
public void statusMessage(java.lang.String message,
java.awt.Color color)
cityInfoMessage
public void cityInfoMessage(java.lang.String message)
- Displays a message in the CIty Info panel.
Most commonly used to display the name of the
currently-selected city.
cityPortInfoMessage
public void cityPortInfoMessage(boolean hasport)
cityUtilityInfo
public void cityUtilityInfo(double utility)
- Displays a utility value in the city info panel
cityPopulationInfo
public void cityPopulationInfo(int pop)
- Displays a population value in the city info panel
cityLaborInfo
public void cityLaborInfo(int labor)
- Displays a labor value in the city info panel
setDragSource
public void setDragSource(java.awt.Point p)
setLastDragPoint
public void setLastDragPoint(java.awt.Point p)
getMaximumSize
public java.awt.Dimension getMaximumSize()
- Returns a Dimension representing the maximum
allowed size of the main window. The resize
control will not grow the window larger than
this size.
adjustSize
public void adjustSize()
initLayout
private void initLayout()
- Initializes and lays out the interface of the game's main
window.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent newEvent)
- Handles events in the main window, dispatching them to handlers
according to their command types.
- Specified by:
actionPerformed in interface java.awt.event.ActionListener
doNew
public void doNew()
doOpen
public void doOpen()
doClose
public void doClose()
doSave
public void doSave()
doSaveAs
public void doSaveAs()
doQuit
public void doQuit()
doUndo
public void doUndo()
doCut
public void doCut()
doCopy
public void doCopy()
doPaste
public void doPaste()
doClear
public void doClear()
doSelectAll
public void doSelectAll()
doEndTurn
public void doEndTurn(java.awt.event.ActionEvent evt)
hideTurnButton
public void hideTurnButton()
showTurnButton
public void showTurnButton()
enableProductionControls
public void enableProductionControls()
disableProductionControls
public void disableProductionControls()