|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.sf.freecol.client.gui.panel.MiniMap
public final class MiniMap
This component draws a small version of the map. It allows us to see a larger part of the map and to relocate the viewport by clicking on it.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private int |
adjustX
Used for adjusting the position of the mapboard image. |
private int |
adjustY
Used for adjusting the position of the mapboard image. |
private java.awt.Image |
back
|
private java.awt.Color |
backgroundColor
|
private int |
firstColumn
The top left tile on the mini map represents the tile. |
private int |
firstRow
The top left tile on the mini map represents the tile. |
private FreeColClient |
freeColClient
|
private static int |
GAP
|
private GUI |
gui
|
private int |
lastColumn
The top left tile on the mini map represents the tile. |
private int |
lastRow
The top left tile on the mini map represents the tile. |
private static java.util.logging.Logger |
logger
|
private static int |
MAP_HEIGHT
|
private static int |
MAP_WIDTH
|
private java.awt.Rectangle |
mapWindow
The part of the panel that is used for the map. |
static int |
MAX_TILE_SIZE
|
static int |
MIN_TILE_SIZE
|
private javax.swing.JButton |
miniMapZoomInButton
|
private javax.swing.JButton |
miniMapZoomOutButton
|
private java.awt.Color |
newBackground
|
static int |
SCALE_STEP
|
private java.awt.Image |
skin
|
private int |
tileSize
|
private boolean |
useSkin
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
MiniMap(FreeColClient freeColClient,
GUI gui)
The constructor that will initialize this component. |
|
MiniMap(FreeColClient freeColClient,
GUI gui,
boolean useSkin)
The constructor that will initialize this component. |
|
| Method Summary | |
|---|---|
boolean |
canZoomIn()
Return true if tile size can be decreased. |
boolean |
canZoomOut()
Return true if tile size can be increased. |
private void |
focus(int x,
int y)
|
private void |
focus(java.awt.event.MouseEvent e)
|
java.awt.Color |
getBackgroundColor()
|
private java.awt.Color |
getMinimapColor(TileType type)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
If the user clicks on the mini map, refocus the map to center on the tile that he clicked on |
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
paintComponent(java.awt.Graphics graphics)
Paints this component. |
void |
paintMap(java.awt.Graphics graphics,
int width,
int height)
Paints a representation of the mapboard onto this component. |
void |
setBackgroundColor(java.awt.Color backgroundColor)
|
void |
setTileSize(int size)
Set tile size to the given value, or the minimum or maximum bound of the tile size. |
private void |
setZoomOption(int tileSize)
|
void |
zoomIn()
Zooms in the mini map. |
void |
zoomOut()
Zooms out the mini map. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int MAX_TILE_SIZE
public static final int MIN_TILE_SIZE
public static final int SCALE_STEP
private static final int MAP_WIDTH
private static final int MAP_HEIGHT
private static final int GAP
private final java.awt.Rectangle mapWindow
private FreeColClient freeColClient
private final javax.swing.JButton miniMapZoomOutButton
private final javax.swing.JButton miniMapZoomInButton
private java.awt.Color backgroundColor
private java.awt.Image back
private java.awt.Image skin
private java.awt.Color newBackground
private boolean useSkin
private int tileSize
private int firstColumn
private int firstRow
private int lastColumn
private int lastRow
private int adjustX
paintMap(java.awt.Graphics, int, int)private int adjustY
paintMap(java.awt.Graphics, int, int)private GUI gui
| Constructor Detail |
|---|
public MiniMap(FreeColClient freeColClient,
GUI gui)
freeColClient - The main controller object for the clientgui - a GUI value
public MiniMap(FreeColClient freeColClient,
GUI gui,
boolean useSkin)
freeColClient - The main controller object for the clientgui - a GUI value| Method Detail |
|---|
public void zoomIn()
public void zoomOut()
public void setTileSize(int size)
size - an int valuepublic boolean canZoomIn()
boolean valuepublic boolean canZoomOut()
boolean valueprivate void setZoomOption(int tileSize)
public void paintComponent(java.awt.Graphics graphics)
paintComponent in class javax.swing.JComponentgraphics - The Graphics context in which
to draw this component.private java.awt.Color getMinimapColor(TileType type)
public void paintMap(java.awt.Graphics graphics,
int width,
int height)
graphics - The Graphics context in which
to draw this component.width - The width of the map.height - The height of the map.
private void focus(int x,
int y)
private void focus(java.awt.event.MouseEvent e)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - a MouseEvent valuepublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color backgroundColor)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||