Package megamek.client.ui.widget.picmap
Class PicMap
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
megamek.client.ui.widget.picmap.PicMap
- All Implemented Interfaces:
- ImageObserver,- MenuContainer,- Serializable
- Direct Known Subclasses:
- MekPanelTabStrip,- SummaryPanel,- WeaponPanel
PicMap is a lightweight component, which area is composed by the set of custom elements added to PicMap Engine. There
 are three main groups of custom elements
1) BackgroundDrawers
2) Hot areas
3) Labels
* Hot areas and labels can be grouped handled together by AreasGroup class. Content of PicMap - Areas group that includes all areas on the stage.
1) BackgroundDrawers
2) Hot areas
3) Labels
* Hot areas and labels can be grouped handled together by AreasGroup class. Content of PicMap - Areas group that includes all areas on the stage.
Added Elements are placed into several layers within PicMap engine.
- Bottom layer is BackgroundDrawers.
- Next is layer of all elements that not implements PMHotArea or PMLAbel interfaces.
- On top of that is layer of Hot Areas - elements with extended functionality.
- Topmost layer is layer of labels.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds background drawer to the stage.voidAdds element to PicMap component.voidPlease remember to add super.addNotify() when overridinggetAreaUnder(int x, int y) Returns Hot Area under coordinates (x, y)Returns Rectangle bounding content of componentabstract voidonResize()onResize() function is calling every time PicMap is resized.voidprotected voidprotected voidprotected voidvoidRemoves all elements from PicMap component.voidRemoves element from PicMap component.voidsetBackgroundOpaque(boolean v) Sets background of PicMap to fully opaque or fully transparent.voidsetContentMargins(int l, int t, int r, int b) Sets margins in pixels around Content of component.voidupdate()Updates all changes in areas state and repaints component.Methods inherited from class javax.swing.JComponentaddAncestorListener, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, updateUIMethods inherited from class java.awt.Containeradd, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Componentaction, 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Constructor Details- 
PicMappublic PicMap()creates PicMap engine. If no areas, labels or Background-drawers added this is just transparent layer over container.
 
- 
- 
Method Details- 
onResizepublic abstract void onResize()onResize() function is calling every time PicMap is resized. Have to be implemented directly to manage composition of component on resizing.
- 
addElementAdds element to PicMap component. Please note, that all objects implementing PMLabel interface will be placed in the topmost layer. All objects implementing PMHotArea will be placed in the middle layer. All others are going to bottom layer. Within same layer objects are drawing by order they added to components.
- 
removeElementRemoves element from PicMap component.
- 
removeAllpublic void removeAll()Removes all elements from PicMap component.
- 
addBgDrawerAdds background drawer to the stage. Background drawers are drawn in order they added to the component.
- 
setContentMarginspublic void setContentMargins(int l, int t, int r, int b) Sets margins in pixels around Content of component. Does not affect Background Drawers.- Parameters:
- l- Left margin
- t- Top margin
- r- Right margin
- b- Bottom margin
 
- 
getContentBoundsReturns Rectangle bounding content of component
- 
addNotifypublic void addNotify()Please remember to add super.addNotify() when overriding- Overrides:
- addNotifyin class- JComponent
 
- 
updatepublic void update()Updates all changes in areas state and repaints component.
- 
paintComponent- Overrides:
- paintComponentin class- JComponent
 
- 
getPreferredSize- Overrides:
- getPreferredSizein class- JComponent
 
- 
getMinimumSize- Overrides:
- getMinimumSizein class- JComponent
 
- 
getAreaUnderReturns Hot Area under coordinates (x, y)
- 
setBackgroundOpaquepublic void setBackgroundOpaque(boolean v) Sets background of PicMap to fully opaque or fully transparent. Notes: Setting Background opaque to "false" switch off buffering of PicMap. Please provide appropriate graphic buffering in container. Notes: Setting Background opaque to "false" does not prevent draw of BackgroundDrawers in PicMap component. Notes: It is required only for Java1.1. Under Java 1.3 and up offscreen will be transparent by default.
- 
processMouseEvent- Overrides:
- processMouseEventin class- JComponent
 
- 
processMouseMotionEvent- Overrides:
- processMouseMotionEventin class- JComponent
 
- 
processComponentEvent- Overrides:
- processComponentEventin class- Component
 
 
-