Class PicMap

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
MekPanelTabStrip, MekSlotLabel, SummaryPanel, WeaponPanel

public abstract class PicMap extends JComponent
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.

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.
Within single layer elements are drawing in the order they added to PicMap.
See Also:
  • Constructor Details

    • PicMap

      public PicMap()
      creates PicMap engine. If no areas, labels or Background-drawers added this is just transparent layer over container.
  • Method Details

    • onResize

      public abstract void onResize()
      onResize() function is calling every time PicMap is resized. Have to be implemented directly to manage composition of component on resizing.
    • addElement

      public void addElement(PMElement e)
      Adds 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.
    • removeElement

      public void removeElement(PMElement e)
      Removes element from PicMap component.
    • removeAll

      public void removeAll()
      Removes all elements from PicMap component.
      Overrides:
      removeAll in class Container
    • addBgDrawer

      public void addBgDrawer(BackGroundDrawer bd)
      Adds background drawer to the stage. Background drawers are drawn in order they added to the component.
    • setContentMargins

      public 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
    • getContentBounds

      public Rectangle getContentBounds()
      Returns Rectangle bounding content of component
    • addNotify

      public void addNotify()
      Please remember to add super.addNotify() when overriding
      Overrides:
      addNotify in class JComponent
    • update

      public void update()
      Updates all changes in areas state and repaints component.
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • getAreaUnder

      public PMHotArea getAreaUnder(int x, int y)
      Returns Hot Area under coordinates (x, y)
    • setBackgroundOpaque

      public 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

      protected void processMouseEvent(MouseEvent e)
      Overrides:
      processMouseEvent in class JComponent
    • processMouseMotionEvent

      protected void processMouseMotionEvent(MouseEvent e)
      Overrides:
      processMouseMotionEvent in class JComponent
    • processComponentEvent

      protected void processComponentEvent(ComponentEvent e)
      Overrides:
      processComponentEvent in class Component